.


:




:

































 

 

 

 





1

: , .

.

(F7).

. , , <F9>. <F5> . Locals . Watch.

Locals Watch

:

<Ctrl> + <F10> - , .

<F10> - ( ); .

<F11> - , , .

<F5> - , , , .

<F9> - /

<Shift> + <F5> - .

, . , , <Alt> + <Tab>.

1

if-else

 

 

Microsoft Visual Studio 2005.

. . File|New|Project ( <Ctrl>+<Shift>+<N>). (Project types:) Visual C++, + . Win32, (Templates:) Win32 Console Application Name: . Location: C:\Work (. ).

 

(. ).

Next>.

 

Additional Options: Empty project (. ).

 

Finish.

Source Files Solution Explorer, Add|New Item

Add New Item. Categories: ( ) Code (. ). Templates: C++ File (.cpp) Name : .

Add.

, <Ctrl>+<S>, Save . .

1

, . , //.

( !). ++ .

 

// #include
// :

#include <iostream> // -

#include <windows.h> //

using namespace std; //

 

int main()//

// (
// )

{

SetConsoleCP(1251); // CP 1251

SetConsoleOutputCP(1251); //

cout << " "; //

double a, b, c; //

cin >> a >> b;

// ( )

if (b) // b 0

{

c = a / b;

// (

cout << " : " << c << endl;

//

}

Else

// ( b 0),
//

cout << " 0\n";

 

return 0; //

}

 

//============================================================

 

, <Ctrl> + <F5>. Yes. ( !!! , ). , 歭 , , .. . <F8>, <F8>. , .

!!! , , . , Lucida Console OK. , .

 

- .

 

2

 

a, b, c. , ,
d = b2 - 4ac . , . , , . , , .

. , <Tab>. .

!!! , , . , Lucida Console OK. , .

 

#include <iostream> //!!! /

#include <math.h>

#include <windows.h>

using namespace std;

int main()

{

SetConsoleCP(1251);

SetConsoleOutputCP(1251);

cout<<" A*x*x + B*x + C = 0\n";

cout<<" A,B,C, ";

double a=0,b=0,c=0,x1=0,x2=0;

cin >> a >> b >> c;

if (a!= 0) // :

{

double d = b*b - 4*a*c;

//

if (d > 0)

{

x1 = (-b + sqrt(d)) / (2*a);

x2 = (-b - sqrt(d)) / (2*a);

cout << " : " << x1 <<" "<< x2 << endl;

}

else if (d == 0)

{

x1=(-b) / (2*a);

cout<<" : " << x1 << endl;

}

else

cout<<" \n";

}

else // b*x + c = 0:

{

if (b) // b!= 0

{

x1 = -c / b;

cout<<" : " << x1 << endl;

}

else if (!c) // == 0

cout<<" \n";

else

cout<<" \n";

}

return 0;

}

, do :

 

#include

#include <conio.h>

/* _getch() */

using namespace std;

int main()

{

SetConsoleCP(1251);

SetConsoleOutputCP(1251);

 

Do

{

 

//

 

} while (_getch()!= 27);

return 0; }

}

. <Esc> .

 





:


: 2016-11-24; !; : 520 |


:

:

, , .
==> ...

1361 - | 1276 -


© 2015-2024 lektsii.org - -

: 0.024 .