, (, ).
C++ , .
, . , , .
, , . .
++ . , .
++ , , , main() ( main() ). main (), .
, main() ++.
() (. header file) , , ( ++ # include). C++ , , ., ( ).
# include < > //
# include //
, ( inline - C++, ) . , , , , . , ++, .. ( , ;).
:
void f1(); // f1
int f2 (int, char); // f2
double sin (double); // ࠠ
/ # include < stdio. h > [1].
Hello, world! :
< stdio. h >
|
|
/*proba_1_1.cpp*/
# include <stdio.h>
#include <conio.h> // _getch()
Int main()
{
printf("Hello, World! \n " [2]);
_ getch () [3];
return 0 [4];
}
, main(), int , . main() . , , .
( , , ). printf () , _ getch () return..
return ; () (). main() (return0;), . , (, , ). return ( ++ , main() 0).
Hello, world! ++ iostream :
/*proba_2_1.cpp*/
# include <iostream> [5]
# include <cstdlib> // system()
Int main()
{
std:: cout << "Hello, world!" << std:: endl [6];
system ("pause"); //
return 0;
}
/ ++ # include < iostream >. ++ std::cout <<, std::cin >>. , , , printf() scanf().
, ++ (, cout endl), std. , . .h, . ++ std, . std:: std.
++ , . () <<, , std::cout (std::cout <<) , ,, , (, x << 2 x 2 , .. 4). .
|
|
std:: using namespace std;. ( .h).
/*proba_2_2.cpp*/
# include <iostream>// ++
# include < cstdlib > // system()
Using namespace std;
Int main()
{
cout << "Hello, world!" << endl;
system ("pause");
return 0;
}