.


:




:

































 

 

 

 


. C++.

C++.

:

a, b, () ,

x ,

y .

 

 

 

 


false

 

 


true

       
   
 
false
 

 

 


               
   
     
 
 
false
   
 

 

 


           
   
     
 
 
false
 

 

 


 
 

 


 


 
 
false

 


. 1. .

 

#include <iostream>

#include <cmath>

#include <math.h>

using namespace std;

 

int main()

{

setlocale(LC_ALL, "Russian"); //

int a = 2, b = 3, c = 5, answer; // a, b, c

double y, x; // x,y

 

cout << " x 1, 6: ";

cin >> x; // x

if (x<1 || x>=6 || cin.fail()) //

cout << ". 1, 6." << endl;

cin.clear(); // ,

cin.ignore(cin.rdbuf()->in_avail()); // (ignore) (avail) (rdbuf)

while (x<1 || x >= 6) {

cout << " : ";

cin >> x;

if (x<1 || x >= 6 || cin.fail())

cout << ". 1, 6." << endl;

cin.clear();

cin.ignore(cin.rdbuf()->in_avail());

}

 

//

if (x >= 1 && x < 2)

y = a + b*x + c*x*x;

 

if (x >= 2 && x < 3)

y = pow((a*sin(b*x)), 2);

 

if (x >= 3 && x < 4)

y = sqrt(abs(a + b*pow(x, 2))) + c;

 

if (x >= 4 && x < 5)

y = a*log(abs(b + (c / (2 * x))));

 

if (x >= 5 && x < 6)

y = exp(a*sin(x)) + pow(c, 3);

 

cout << " y: " << y << endl; // y

cout << endl;

cout << " ? 1 0 ."<< endl;

cin >> answer;

if (answer > 1) cout << " . 1 0 ." << endl;

while (answer > 1) { //

cout << " : ";

cin >> answer;

if (answer > 1) cout << " . 1 0 ." << endl;

}

//

switch (answer) {

case 1:

exit(0);

break;

case 0:

system("Pause");

break;

}

return 0;

}

1 , . x (5).

. 2. 1.

2 , , . x (4).

. 3. 2.

++. , , , . . (sqrt()). (exit(0)).

1. .. /++. - -. , 2006.

2. -: http://www.programmersforum.ru/showthread.php?t=98038

3. -: https://cppstudy.wordpress.com/2009/03/27/cin-get-and-co/

4. () 19.701-90

5. .. , , , 2016/2017.



<== | ==>
. | II (--)
:


: 2016-12-05; !; : 511 |


:

:

, , .
==> ...

1770 - | 1672 -


© 2015-2024 lektsii.org - -

: 0.017 .