.


:




:

































 

 

 

 





-

 

- stdio.h conio.h, #include <stdio.h> / #include <conio.h> .

printf . , .

printf (_ [, 1] [, 2] [,]);

( ) printf, , , . , , . :

, , ,

, \n, \t, ( \),

, ( %).

, printf , . . , .

 

/C++
int %d
float, double %f
char %c
char *, char [] %s

 

, printf (Hello!) Hello!. printf (%d, x) x. , ,

 

 

, i x. . , i 5, x 1.5, : 5‑ 1.500000.

(%d, %f, ..) (int, float, double ..). . i (int), x (float double).

printf -, ESC ( \). :

 

\n lf (line feed)
\t ht (horizontal tab)
\v vt (vertical tab)
\a bel (audible bell)
\b bs (backspace) ()
\ (single quote)
\ (double quote)

 

scanf. .

scanf (_, &1 [, &2] [,]);

scanf printf, , scanf , . scanf & ().

scanf . (-). , Backspace. , Enter. .

getch conio.h . scanf, Enter . , . , . , .

-.

1. , * , .

. . .

//

 

#pragma hdrstop

#include <stdio.h> //

#include <conio.h> // -

 

#pragma argsused

int main (int argc, char* argv[])

{

printf ( *\n); //

printf ( * *\n); //

printf ( * *\n); // printf

printf (* *\n); // .

printf ( * *\n); //

printf ( * *\n); // \n.

printf ( *\n); //

getch(); //

return 0; //

}

//

-

- iostream.h, #include <iostream.h> . cin cout, . ( cin) ( cout). :

cin ( >>),

cout ( <<).

cin >> ;

cout << __;

cin (.. ) . cout (.. ).

:

cout << index; // index

cin >> x; // x

cout << Enter your name; //

cin >> name; // name

-, . index, x, name (int, float, char ..), . . , . C++ , ( ) .

cout ESC‑ (`\n`, `\t`, `\b` ., . ), printf. , cout . , endl (end line) . cout << endl, , , cout << \n.

-

//

 

#pragma hdrstop

#include <iostream.h> // cout

#include <conio.h> // getch

 

#pragma argsused

int main (int argc, char* argv[])

{

cout << *\n;

cout << * *\n;

cout << * *\n;

cout << * *\n;

cout << * *\n;

cout << * *\n;

cout << *\n;

getch();

return 0;

}

//

, .

. C++ , . , c ,

 

/C++ /C++
+ f + 7 f + 7
- p c p c
* bm b*m
/ x/y x/y
% r mod s r% s

 

C++ , . C++ : ; , , ; . :

: /C++:.

, .

, C++ . math.h, #include <math.h>. :

 

/++
  sin(x)
  cos(x)
  tan(x)
  sqrt(x)
  pow (x, y)
  exp(x)
  log(x)
  fabs(x)
  asin(x)
  acos(x)
  atan(x)

 

( ) . , -. , y 2:

float x = 2.0; float y = sqrt(x);

math.h ,

 

/++
  M_PI
  M_E
  M_LN2
  M_LN10

 

, a, b, c a, b, g.

. , . a, b, g , 180/p.

//

#pragma hdrstop

#include <iostream.h> // -

#include <conio.h> // getch()

#include <math.h> // acos(x) M_PI

 

#pragma argsused

int main (int argc, char* argv[])

{

float a, b, c; // a, b, c

cout << input a ; //

cin >> a; // a, ..

cout << input b ;

cin >> b;

cout << input c ;

cin >> c;

 

float alpha, betta, gamma; //

alpha = acos((b*b + c*c a*a)/(2*b*c)); // alpha

betta = acos((a*a + c*c b*b)/(2*a*c)); // betta

gamma = acos((a*a + b*b c*c)/(2*a*b)); // gamma

cout << \n alpha = << alpha/M_PI*180; //

cout << \n betta = << betta/M_PI*180; //

cout << \n gamma = << gamma/M_PI*180; // ( )

cout << \n << alpha + betta + gamma; // =pi?

getch(); //

return 0; //

}

//

 

 





:


: 2016-09-03; !; : 766 |


:

:

, .
==> ...

1356 - | 1180 -


© 2015-2024 lektsii.org - -

: 0.028 .