?????? ????? ????? ???? ??????? ?????? ??????? ??? ???? ??? ??? ???? ????? ????? ??????? ?? c++ ????? ?? ???? ?? ???? ?? ??? ??????? ????? ???? ??????? ????? :
?????? ????? ??? ????? ??????? ?? ??? ???? ? ?????? ????? ?????? ??? ??? ???? ??? ??? ..... ? ?? ??? ????? ???? ?????? ?????? ???????? ??? ???? ..... ?? ?? ??????? ????? ???? ????? ??? ??? ?? ???? ???????? ???? ?? ??? ?????? .
??? ?????? ???? ?????? ????? ?? ???? ?????? ??? ??????? ???????? ???? ???? ? ???? ??? ??? ? ??? ??????? ???????? ??????? ? ????? ????? ??? ????? ??????? ???? ?????? ?? ?????? ????????? ?? ????? ????? .
????? ?????? ?? ??? ??????? ??? ???? ???? ??????? ??? ???????? ???? ??? ??? ?? ????? ?? ????? ????? ????? ??? ??? .
???? ?????? ?? ??? ???? (???? ?????? ?? ?????? ?? ?????? ?? ??? ????) :
?? C ??? C++
? - ????? :
1- ?????? (??? ??????).
2-???? ??????? (???? ??????? ?? ??????? - ???????? ??? !
).
3-????? ?????? ???? ???? ???? .
?-??????? ??? ??? C
(?? ?????? ????? ?? ???? ??? ???? ??? ??? ??? ?????? ???? ????????? ?? ??? ???? .... ? ?? ???? ?? ???? ?????? ?????? ???? ????? ???? ?????? ?? ??? ???? ?? ????????) :
1- ???????? ????? .
2- ??? ???????? ????? .
3- ????? ????? ???????? .
4- ????? ????????? .
5- ???? ????? ????????? .
6- ????? ?????? ????????? .
7- ???????? ???????? ???????? .
8- ??????? ??????? ? ??????? .
9-???????? ??? C++ .
-???????? ????? .
?? - ???? ?????? ?? ??-?? ??? ???
(??? ?? ????? ?? ??? ???? ???? ???? ?? ???? ??? ??? ???????? ??????? ):
1- ?????? ??? ????? IF .
2- ?????? ??? Switch .
3- ????? ??????? (For - While) .
4- ?????? ??? ????????? .
5- ??? ???? ???? ????? ?
-???????? ?????? .
? - ??????? ??? ???? ++ :
1- ????? ?? ++ ?
2- ??????? ??????? .
3- ????? ??? Class .
-???????? ??????? (????? ??????) .
?????? ?? ??? ????? ??? ?????? ???? ?? ???? ?????? ???? ????? ??????? ?????? ?? ???????? ? ?? ??? ??? ???? ????? ? ????? ??????? ? ?????? ..... ?? ??? ????? ???? ???? ?
..... ??? ???? ????? ??? ????? (????? ???????? ??? ??? ???????)
???? ??? ??????? ?? ?? ?????? ?????????? ????????? ?? ????? ???? ???? ??????? ?????.
??? ???? ?? ????? ???? ???????[Johnson 73]B ???? ??????? ?? ????? ???? BCLP [Richards 79] . ???? ??? ???? ?????? ??? 1972 ?? ????? ???? ?? ??? 1977 ? 1979 ????? ????? ???? ??????? ?? ??? ?????? .?? ????? ??? ?????? ??????? ?????? ??? ???? ???? ???? ???? ??? ???? ?????? ?? The C Programming Language ?? ?? ???? ???? ?????? ?????? ?? K&R . ?? ????? ?????????? ????????? ???? ???????? ???????? ???? ????? ?????? ANCI C ?? ???? ???????? .
* ??? ?? ???? ??? ?????
??? ????? ?????
dmr@bell-gabs.com?????????????????????????????
????? ???? ??? ??? :
? ?? ???? ??????? ? ????? ??? ?????? ?? ?? ?????? ??? ????????? ?????? ?? ????? ???? ???? .... ??? ????? ???? ?????? ?????? ??? ????? ??????? ??????? ??????? ? ????? ???? ??????? ?????? ????? ?? ????????? ?? ????? ???? ?? ?????? ??? ?????? ? ?????? ? ??? ???? ????? ?????? ?????? ???? ????? ?? ??????? ?????? ===> ??? ???? ?????? ???? ???? ??? ??? ...
?????? ??? ????? ??? ?? ??????? Bjarne Stroustrup ?? ??? 1979 ?? ????? ??? ?? ??????? ....
?? ??????? ????? ??? ??? ????? ????? "C with Classes" ?? ?? ?????? ??? C++ ?? ??? 1983
??? ???? ??? ??? ????? ??? ???? ????? ??? ???? ????????? (???????? ?????? ?? ??????? ??????) .
??? ??? ?? ????? ?????? ???????? ???????? ???? ????? ?????? :??? ???? ??? ????? ???? ?? ??? 1994 .
????? ??????
???? ????????
???? ??????? ??? ????? ??????? ?? ????? ?????? ????? ?????? ??? ???? ?? ??? ????? ??.
?? ??? ???? ?? ????? ?? ?????? ??? ??? ?? ????? ?????????? ?????? ?? ????? ??????? ?? ??????? ???? ??? ?????? .?????????? ???? ??? ????? ?????? ??????? ?? ???????? ??? ????? ??? ??????? ??? ????? ???????? ??? ?? ??????? ??? ?????? ?????.???? ??? ???? ????? ??????? ????? ??? ?? ?? ??? ??????????? ??? ?????? ?????.???? ???? ????? ??? ????? ??????? ??? ?? ???? ???? ????? ??????? .?????? ?? ??????? ?????? ??? ??????? ??? ??? ??? ??? ?? ?? ???? ??? ?????? ?? ??? ???? ?? ?? ???? ??? ??????? ??????? ???? ?? ?? ????? ???? .
?? ?? ?????? ????? ?
?????? ?? ?? ??? ???? ???? ???? ?? ???? ?????? ?????? ?? :??????? ?????? ???????? ? ????? ??????? ? ???????.??????? ?? ????? ??????? ?? ??????? ?? ??????? ???? ???? ????? ???? ?? ??????? ?? ???????? ? ???? ????? ??????? ? ??????? ??????? ???? ????? ????? ?????? ??? ???? ???????? ? ???????.
???????, ??????? ? ?????:
?? ?????? ??????? ??? ???? ???? ??????? ?? ??????? ???????:
• ???? ?????? ?? ??(editor)
• ??????? ?? ??(compiler)
• ???? ??????? ?? ??(operating system)
???? ???? ????? ?? ???? ?????? ????? ?? ????? ??????(source file) ??? ????? ?? ???????? ???? ????? ??????? ???????? ???? ?? ????? ??? ????? ?? .c ?? ???? ???? ??????? ??? ???? ?? ??????? ????? ?????? ???? ???????? ????? ?????? ???? ?????? ?????? ???????? ??? ??? ????? ? ??????? ??? ?? ?? ??? ?????? ???? ??????? ???? ?????? ???? ? ?? ??? ??????? ???? ?????? ?? ??????? ???????? ???? ???? ?? ???? ?????? ??????? ??? ??? ?? ???? ??????? ??? ????? ?? ???? ??? ??????? ???????? ?? ??? ??? ????? ?? ???? ?????? ????? ?? ????? ??????? ? ?? ?? ???? ?? ??????? ????.
???? ????? ?? ??:
?? ???? ????? ??????? ???? ??? ??????? ??? **** ?? ??? ?????? ?? ?? ?????? ?? ????? ????? ?????? ?????.????? ??? ?????? ?? ??????? ???????? ???????? ???????? ?? ????? ????? ??? ?????????? ????????.
???? ?????? ?? ??????? ??????? ???? ???? ???? ??? ??????? ???? ? ????? ??? ?????? ??? ??????? ???????? ????? ????? ????????? ??? ??? microsoft visual C++ ??? ??? ??????? ???????? ??????? microsoft visual studio.
?????? ???? ??? ??? ????????:
??? ??? ???????? ????? ???? ???? ????? ??????? ?????? ??? ??? ???????.???? ?? ????? ??? ?????? ????????
?????? ??? ??? ??????? ???? ?????? ??????? ????? ????? ??????? ???????:
• ?? ????? ??? ???? ????? ????
• ?? ???????? ??????? ???? win32 console application
• ???? ???? ??????? ?? ?????? ?????? ???? ????? ?????? ???? ???? ?? ????? ??????? ???
• ???? ?????
• ?? ????? ??? ???? ????? ???? ??? ????
• ?? ???????? ????? ???? c++ source file
• ???? ???? ???????? ?? ?????? ??????
• ???? ?????
• ? ???? ???? ?????? ?????? ??????? ??? ?????? ??????? ???? ?????
/* File hello */
#include
int main(void)
{
printf("hello world!n");
return 0;
}
• ?? ????? (build) ???? ????? (compile) ?? ????? ????? ? ???? ???? ???? ?? ???????? ?? ???? ??????? ? ?? ????? ????? ????? ?? ??????? ???????? ?? ??? ???? ?????
• ?? ????? (build) ???? ????? build ?????? ????? ??? ????? ???????? ?? ??? ???????
• ???? ?? ????? (build) ???? ????? execute
• ??? ???? ?? ????? ????? ????? ?? ??? ????
/* File hello */
#include
int main(void)
{
printf("hello world!n");
return 0;
}
/* File hello */
?? ?? ???? ???? ?????? ??? ???????/* ?? ??*/ ?? ????? ?? ????? ??? ????? ?? ??? ????? ?? ???? ???? ???????? ?????? ??? ?????? ???? ??????? ??????? ???? ?? ??? ??????? ???? ?? ???? ?????? ??? ????? ??????? ????? ??????? ?? ?? ???? ??? ????? ??????? ?????? ????? ???? ??? ?????? ???????.
#include
?? ??? ?????? ????? ??????? ?????? ?????? ???? ?? ??? ???????? ? ???????? ???????? ? ??????? ??? ????? ????? ????? ?? . ?? ????? ?? ??? ?????? ?? ???? ??? ????? ??? ????? ??? ????????? ??????? ??????? ???????? ??? ? ???????? ???????? ?? ????? ??????? ? ??????? ???????? ??? ???? ????????(?????)? ??????(?????).??? ???? ???? ????? ??? ?????? ????? ???? ??????? ??????? printf( ) ?? scanf( ) ?????? ????? ??? ?????? ??????. ?????? ?? ???? ????? ???? ????? ???? ????????? ???? ? ?????? ?????? ? ????? ???? ?? ????? ????? ????? ??? ?????????.
________________________________________
int main(void)
?? ?????? ????? ??? ???? ????? main ???? ????? ????? ???????? .??????? ??? ???? main ???? ??????? ??? ??? ???? .int ?? ???? ?????? ???????? ??????? ?? ?? ????? ??? ????? ?? ????? ???? ????? ??? ??? ???? ??????? ??? ?????? ???? ??????? ?????? ?? ?? ??? int ???? ????? ??? ??? ??????? ???? ???.
?????? ???????? void ?????? ??? ?????? ?? ???? ???????(arguments).
________________________________________
{
????? ??????? ?? ??? ?? ?????? ?? ????? ??? ??????(Body) ? ??? ?? ?????? ??? ?? ?????? ??? ????? ?????? ??? ?? ???? ?????. ? ???? ????? ??????? ????? ? ????? ????? ?????? ??? ????? ??? ??????? ?? ??? ????? ? ??? ?????? ?????? . ?????? ??????? ????? ??? ?????? ?? ????? ?? ???? ????? ?????.
________________________________________
printf( );
?? ???? ?? ????? ??? ?????? ?? ?????? ????? ????? ????????? ?? ?????? . ??? ???? ?? ????? ???? ???????? ????? ?? ??????? ??? ??????.??? ?????? ????? stdio.h ???? ????? ??? ??????? ????? ??? ??? ?????? ? ??? ????????? ???? ????? function prototype ????? ?????? ???? ??????.
________________________________________
printf("hello worldn");
??? ???? ?????? printf( ) ?? ????? ???? ?? ???? ?????? “hello, world!n”
?? ?????? ?? ??? string ?? ?? ?? ???? ?? ?????? ??? ?????? ??????? .???? ?? ?????? ??????? ????? ?? ?????? ????? ???? ????? ?????. ??? ?????? ???? ??????? ??? ??????.??? ????? ?? ??? ?????? ??? n ?????(backslash n) ???? ?????? ????? ?????? ?? ???? ???? newline ??? ??? ??? ???? ??????? ??????? ?? ????? ?????? ??? ????? ?????? .?? ???? ????? ????? ??? ?????? ??? ???? ??? ?????? ???????????? ?? ????? ??????.??? ?????? ???????? ??? ????? ??? ??? ?? ???? ?? ????? ?????? ??? ????? ??????. ???? ?? ??? ????? ????? ?????? ??????.?? ???? ?????? ???? ????? ??? ??? ?????
(statements)????? ???? ??????? ? ???? ?????? ???? ????? ??? ????? ????????(declarations).
________________________________________
return 0;
?????? ???????(integer) ??? ?? ?????? ???? ?????? ?????? main( ) ????? ???????.??? ????? ???? ?? ?????? ?????? ???? ????.
________________________________________
}
??? ????? ?????? ?? ??? ?????? ?? ?????? ????? ????? ??????? ?? ??? ?????? ??? ???? ??????.
????? ????? ????????
??? ????? ?? ?????? ???
?? ?? ?????? ???? ?? ????? ?? ??? ?? ???? . ?????? ??????? ??? ?????:
• :Source files
?????? ??? ????? ???????? ??? ????? ???? ????? ?? ???????? ????? ?????? ?? ?????? ?? ?????? ????? ?????? main ???? ???? ????? ???????. ??? ????? ??? ????? ?? ??????? ??? ???? ?????? ????? ???? ????? ?? .c ??????? ??? ???? .???? ?? ???? ????? ???? ?? source file ?? ???????? ?????? ??????? ??? ???? ????? ?? ?????? ?? ????? ????? ????? ?? ?????? ??????? ?? ??? ????.
• Header files:
???? ?? ????? ???????? ?? ??? ?? ??? ???? ?? header file ??? ?? ????? ??? ?? ???? ??? ?? ???? ??? ?? ??? ??????? ???? ????? ?????? ?????? ????? ???? ??? stdio.h ? string.h ? conio.h ? ????? ???? ??? ??? ????? ?? ??????? ?? ????? ????? ?? ???? ??????? ????? #include?? ??? ????? ?????? ??? ????? ?????? < ??? ?????> . ????? ????? ????? ?? ??? ????? ????? ??? ???? ?????? ?? ??? ???? ??? ??? ?????? ??????? ??? ????? #include ???? ???? ????? ????? ??? ????? ??? ?????? ????? ????? ?? ??????? ??????? "??? ????? ". ?????? ???? ????? ?? ??????? ???? ???? ?? ???? ?????.
?? ?? ????? ????? ???????
?? ???? ?? ????? ?? ?????:
• Header
1. ????? ??? ?? preprocessing directive ???? ?? ?? ??? ?????? #include ???????? ????? #define ????? ?????? ????? ?????? ??? ???? ??? ?? ??? ???? ???????? #.
2. ????? ??? ??? ?????? ?????? ?????????? ???? ?????? .
• Body
??? ???? ?? ???? ?????? ? ????? ??? ????? ??????? ? ????? ????????? .????? ?? ?? ??? ????? ?????? ??????. ????? ??? ?????? ?????? ??? ????? { }.
??????? ???? ????:
• ?????? #include ???? ?? (preprocesser) ???? ???? ?? ?? (header file) ?????? ?? ?????? ???? ???? ??? ??? ??????.?? ??????? ??????? ??? ??? ????? ?????? ??? ??? ????? ????? ?? ?????? ???????.?? ?? ??? ?????? ?????????????? ????? ?? ???? ???? ????? ?? ??? ?????? ?? ?????? ??? ??? ?????? ?? ??????? ?? ?????? ???? ????? ??? ???????? ??? ???? ?????? ??? ?? ???? ?????. ??? ?????? ??????? ??? ??? ????? ????? ?????? ????? ???? ??? ??? ????? ????? .
• ??? ???????? ????????? ?? ??(comments) ?? ??????? ??? ????? ????? ?????? ?? ??? ??????? ? ???????? ??? /* */ ???? ?????? ??????? ?? ???? ?? ??? ?? ?? ???? ???? ?? ???? ??? ??????? ???? ??? ????? ?????? ?? ???? ??????? ???????? /* ???? ?? ?????? ??????? ????? ???? ????? ?? ?????? /* */ ???? ????? ???.???? ???? ??????:
/* this is
a comment */
/* but /*this*/one is not */ ????? ?????????
???? ????????
??????? ?? ?? ??? ???? ???? ?? ??????? ????? ??????? ????? ? ???? ?? ????? ?? ??????? ?? ?? ??????? ???????? ???????? ????? ????? ???? ????? ?? ?? ??? ? ??? ?????? ??????? ??? ?? ?? ?? ?? ???? ??????? ??? ???? ??????? ?? ????? ?????? ?? ??????.
????? ?????????:
???? ??? ????? ????????? ? ??? ????? ??????? ?? ??? ?? ???? ???? ?? ??? ???????
int ??? ??????? ??????? ?? ???? ?? ????? ??? ????? ?????
double ?? float??? ??????? ???? ????? ??? ????? ????? ?? ???? ???? ???????? ?? e ??? 3E2
char ??? ?????? ???????? ? ????? ?? ?????? ???? ????? ??? ???? ???????
???? ?????? ??????
#include
int main (void)
{
int inches,feet;
feet=6;
inches=12*feet;
printf("feet=%dn inches=%dn",feet,inches);
printf("feet=%dn",feet);
printf("inches=%dn",inches);
return 0;
}
???? ??? ???????? ??? ??? ?????? ?????? ?? ????? compile ?? ???? run ??? ?? ????? ?? ?????? ??????? ?????? ??? ?????? ???? ?????? ???????:
?? ?????? ?????? ?????? ???????? ?? ??? int ????? ?? inches ??????? ?? feet ?????? ?? ??? ????? ????? ????? ????? ?????? ???? ??? ??? ?? ????? ???? ??????? ????? ????? ?????? ?????? ???? ????? ????????? ????? ?? ??????? feet ?????? 6 ?? ???? ?? ??????? inches ??????? ???????? 12*feet ????? ??? ???? ???? ????? 12 ??????? ?? ???? ??????? feet ?????? ?? ????? ????? ????? ????? ??? ?? ????? ???? ???? ??????? ??? ?????? ??????? ??????? + ?-? / ? % ???? ????? ????????compilation ????? ?? ???? ?? ?? ???
+ : ????? ????? ??????? 1+1 =2
- : ????? ????? ??????? 1-1=0
/ : ????? ?????? ??????? 4/2 =2 ???? ??? ?? ????? ??? ??? ??? ??? ??? ??????? ???? ???? ??? ???? ????? ?????? ?? ?? ??? int ???? ????? ??? ????? ?????? ?? ??????? ???? ????? ????? ??? ?????? ????? ???? ????? ????? ????? ?? ?? 7/2=3 ???? 3.5 ??? ?? ????? ? ??? ??? ???? ??? ?????? ?? ???? ?? ??? float ??? ?????? ????? ?????? ???? ???? ????? ??? ??? ?? ???? 7.0/2.0 ???? 7/2 ??? ??? ???? ?? ???? ?????? ??????
?? ????? ???????? ????? ??? ????????? ??? ?????? ???????? ????? printf
Printf ??? ?????
????? ??? ???? ????? ??? ?????? ?????? ? ?????? ?? ????? ?? ??? ????:
???? ? ??? ????? ???? ?????? ??????? ???? ?????? ????? ????? ?? ???? ???? ?? ???? ??? ?????? ????? ? ????? ?????? ????? ??? ??????? ??? ?? ??? ????? .?? ?? ???? ????? ?? ????? ????? ???? ??? ?? ??? ?? ???????? d% ?????? ?????? ????????? ??? ???? ??????? ???? ??? %d???? ??? ????? ? ???? ????? ???? ??? ?????? ???? ??? ???????.
%d ????? ??? ??? ??? ??????? ?????? ?????? ?????? ???? %f ??? ??? ?????? ????? ????? ?? ??? float ?? double
????? %c ?????? ?????? ????? %s ?????? ????? ?? ??????.
???? ????? ?????????
?? ?? ???? ????? ??????????
• ?? ????? ??? ????? ?? ???? ?????? ? ????? ? ????? ????? _ (underscore)
• ?? ???? ??? ??? ?? ??? ?????? ???????? ?????????? ???????? ?? _ ??? ??? ????? ????? ?? _ ????? ????????? ??? ???? ???? ???? ??????? ?????? ???????? ???? ??? ????? ???? ????????
• ???? ????? ???? ???? ??? ?????? ??????? ? ??????? ?????? A ????? ?? a ???? ???? ????? ??????
???? ??????? ??? ??????? ???????? ?? ?? ???? ??? ?????? ????? a ?? ??? ???? ??? ??? ? ?? 65 ??? ??? ??????? ASCII ??? ??????? ???????? ?? ???????? ???????
• ?? ?? ???? ??? ????? ?? ??? ??????? ???????? ?? ???? ???? ??? ???? int
• ?? ?????? ???? ???? ?????? ???????? ?? ???? ??? printf
• ?? ?? ???? ???? ??? ?? ???? ? ??? ???? ?????? ????? ?? ???? ?? ???? ? ?? ???? ???????ANCI C ??? ??? ???? ?? 31 ???
????? ???????? ????? :
K
_id
imanidentifier2
so_am_I
???? ???:
not#me ???? ????? ??? #
101_south ???? ???? ????
-plus ???? ????? ??? – ? ??? _
??????? ????????keywords
align="center">
Auto break case char const continue
Default do double else enum extern
Float for goto int if Register
return short signed sizeof static switch
Struct typedef union unsigned void Voltaic
while long
***??? ?? ???? ?? ??? ?????? ??? ????????? ???? ??? ????? ?????? ???? ?????? ????? ?? ?? ???? ???? ???? identifier ???? ??? ??? ???? ????????? ? ????? ?????? ?????? ????? ???????? ???? ?????? ????? ? ?????.
?????? ?? ??? ????? ???? ???? ????? ??? ????? ???? ?????????? :
?? ???? ?????? Microsoft Visual C ++ .o
File -> new
????? ??? ??? ?????? 1:
?? ????? ??? ?? ?????? 2:
?? ???? Next ???????? ??? ???? ???????? ?? ???? ??? finish .
????? ??? ?????? 3 : ????? ???? Resource View ????? ????? IDR_MAINFRAME
????? ??? ????? ??? ?????? ?? ??????? ????? ????? ?????? ????? ????? ???? ????? ??? Graphics ????? ??? ????? ???? ???? ???? ???????? ???? ??????? ???? ????? . ??????? ??????? ?? ?????? ??? ?????? ?????? ?????? ??????? ?? ???? ?? ???? ..??? ?? ?????? 4:
??? ???????? ?? ????? ??????? ????? ?????? ??????? :
???? ?????? Ctrl+w ???? ???? Class Wizard
??? ????? Object IDs ????? ID_GRAPHICS_LINE?? ????? Command ?? ADD Function ?? OK
???? ?????? ?????? Line ??????? ????? ?? ???? ?????? ??? Edit Code
?? ???? ??? ????? :
void CMainFrame::OnGraphicsLine()
{
// TODO: Add your command handler code here
int i;
CDC*PDC = GetDC();
for(i=0;i<100;i++)
{
PDC->MoveTo(-100,-200);
PDC->LineTo(300,400);
}
}
??? ????? :
???? ?????? ????? ???? PDC ?? ????? CDC ??? ????? ???? ??? ??? ???? ????? ???? ????? ????? ?????? ????? GetDC
????? ???? ??????? ?? ?????????? (-100,-200) ????? ??????? ?? ?????????? (300,400)
???? ?????? ????? 100 ??? .
??????? ????? ?????? ?? ?????? ??? ?????? Ctrl+F5.
??? ???????? :
??????? ??? ??? ???????? ???? ???????? ??????? ?????? ?? Object IDs ???????? ??? Rectangle. ?? ???? ????? ?????? :
void CMainFrame::OnGraphicsRectangle()
{
// TODO: Add your command handler code here
int i ;
CDC*PDC = GetDC();
PDC->MoveTo(10,300);
PDC->Rectangle(100,100,200,200);
}
????? ??????? :
??? ??????? :
??????? ??? ??? ??????? ???? ???????? ??????? ?????? ?? Object IDs ??????? ??? Ellipse. ?? ???? ????? ?????? :
void CMainFrame::OnGraphicsEllipse()
{
// TODO: Add your command handler code here
int i ;
CDC*PDC = GetDC();
PDC->MoveTo(0,100);
PDC->Ellipse(100,100,200,200);
}
????? ??????? :
????? ????? ???????? ?? ?????? ?????????? : (100,50,300,300)
??? ????? Clear :
???? ?????? ????? ????? ?????
void CMainFrame::OnGraphicsClear()
{
// TODO: Add your command handler code here
system("clrs");
}
????? ????? : ???? ???? ??? ++C
??? ? ???? ???? ????? ????? ?? ?????? ???? ????? ?? ??? ??????? ++C ? ???? ?????? ?? ????? ??? ???? ????? ??????? ?? ??? ???? ?????, ? ?????? ??? ??????? ?? ??? ??????? ?? ???? ??? ????? ????? ???????? (???????????) ? ?? ????? ??????? ??????? ? ????? ???? ??????? ??????? ? ??????? ??? ?? ????
????? ?????? .. ??? ???? ???? ???? ????
??? ????? ???? ??? ++C
?????? ?? ????? ?????? ??? ??? ???? ??????? ????????? Microsoft Visual Studio 6.0 , ?? ???? ??? ?????? ? ????? ????? ?? ??????? ???????? ????????, ? ?? ???? ??????? ???? ??? ??????? File ?? ???? ????? New ????? ????? ?? ????? ???? ?????? New ???? ??? ???? ??????? Projects ? ?? ?? ???? ??? ????? win32 Console Application ? ?? ???? Project name ?? ????? ???? ????? ??????? ????? ? ???? ????? Test1 ?? ?? ???? Location ??? ?????? ???? ???? ?? ???? ??? ??????? ??? ? ???? ??? ?????? ?????, ? ???? ?? ????? ?????? Create new workspace ? ?????? Win32 ? ????? ???? ???? OK ? ????? ?? ????? ???? ????, ? ????? ???? ??? ???? Finish ????? ???? ???? ??? ?????? New Project Information ???? ?? ??????? ??? ??????, ????? ???? ???? OK, ? ????? ??? ????? ????? ????.
???? ??? ??? ??????, ???? ???? ?????? ???? Test1 ? ?? ????? ?? ???? ??????? ???? ??? ???????, ? ???? ??? ?????? ???? ???? ???? debug ? ?????? ?????, ?? ???? ???? ????, ?? ??? ???? ??????? ? ?? ?? ???? ??? ????? New ?? ????? File ??? ???? ????? ?? ??? ????? ?????? ?? ??????? New ???? ??? ???? ??????? Files ?? ???? ????? C++ Source File ? ???? ?? ?????? Add to Project ???? ? ?? ??????? ?? ??? ??????? ???? ?????? Test1 ? ?? ?????? File name ?? ????? ???? ????? ? ???? First ?? ???? ???? OK ? ????? ????? ?????? ??? ????? ?????? ???? ??? ++C ?? ??? ????.
???? ??? ??????? Test1 ??? ??? ?????? ???? ??? ?? ?? ????? ??? ???? First.cpp ? ?? ????? ???? ????? ??? ??????? ???????? ???? ????? ????????, ? ???? ??? ????? ?????? ?? ??????? ???? ????? ?????.
???? ??? ??????? ??? ???? ????? ???? ? ?? :
1. Workspace : ??? ???? ??? ????? ???? ??????? ???? ???? ????, ???? ??? ??? ??? ??????? Test1 ??? ??? ????, ? ????? ???? ????? ??? ????? ????? ???? ?????? ???????? ???????.
2. File .cpp : ??? ????? ?? ????? ?? ????? ???? ??? ??????? ? ?? first.cpp ? ???? ????? ???? ??????? ???????? ?????? ????????
3. Output : ????? ???? ???????? ????? ??????? ?? ???? ??????? Compiler ? ??? ?????? ??? ??????? ?? ???? ????? ?? ??????? ????????? (?????????) Syntax Errors ? ????????? Warning ?? ???? ?? ???????.
????
?? ??????? ????? ??????? ??????????
??????
???? ??????? ????????? IDE Integrated Development Environment ???? ??? ??????? ??? ?? ?????? ???? ???????? ?? ???? ???????, ? ???? ???? ????? ???? ???? ???? ?????????? ?????? ?????? ?????? ??? ?????? ??? ????? ???? ??????, ??? ??? ??????? Compiler ???????? Libraries ? ??????? Tools ? ??? ????? ?????? ?? ???? ????? ??????, ????? ?? ????????? ?? ?????? ????? ????????.
??? ? ????? ???????
???? ??? ??? ???? ? ????? ??????? ? ?????? ?? ???? ???? ???? ??????? Visual Studio ?? ?? ??????? File ???? ????? Open Workspace ? ????? ?? ????? ????, ??? ??? ???? ?????? Test1 ? ???? ?? ??? ??? ??????, ????? ????? ?? ??? ???? Test1.dws ?? ?????, ? ???? ?? ????? First.cpp ?? ?? ???? ???????? ????? ?????? ?? ????? ??????? ???????? ?????? ??. ? ??? ???? ?? ???? ?????? ??? ???? ??????? File ?? ??????? ????? Close workspace ? ???? ???? ?? ????? ??? ????? ????? ?????.
??? ?????? ?? ???? ++C
????? ??? ??????? ????? ????? ??? ??? ??? ++C ?? ???? ?????? Test1 ?? ?? ?????? ??????? ???????? ???????:
1 #include<iostream.h>
2 void main()
3 {
4 cout<<" By The Name Of ALLAH " ;
5 }
????? ??? ??????? ???? ???? ??? ?????? ?? ????? ??????? ? ??? ??? ????? ?? ????????. ?? ????? 1 ???? ??? ???? ???? include (?? ???) ??? ???? ?? ?????? ?? ???? ??? ?? ??? ????????, ?? ?? ??? ?????? ??? iostream.h , ? ?? ?? ??? iostream.h ? ????? ???? ?? ????? ??? ????????? ????? .. ??? ????? ???? ?? ???? ???? ?? ???? ?????? ??? ????? ????? ??? ????? ??? ?????, ???? ???? ????? ?? ????, ???? ????? ??? ????? ?? ?????? ? ?????, ? ????? ???? ?? ???? ??????? ?????? ???? ????? ??? ????? ?? (????? ? ????? ? ?????? ? ?????) ? ??? iostream.h ?? ????? ?? ??? ???? iostream Input Output Stream ? ???? ????? ????? ? ????? ?? ???? ????? ? ????? ? ????? ??? ????? ?? h Header ? ???? ???? ? ??? ????? ?????? iostream.h ???? ??? ??????? ??????? ?????? ?????? ????? ???? ??? ?? ?????? ?? ???? ???????? ? ????? ?? ????? ?????, ? ?????? ?????? ?????? ????? ??? ?????? ? ????? ?? ????? ?????, ? ??????? ???? ???? ?? ???? ?????? ?????? ????? ????? ?? ????? ???? ????? ??? ??????? ???????? ?? ????? iostream.h ??? ???? ???????? ???? ????, ???? ??? ???? ?? ????? ??? ?? ?????? ???? ??????? ??????, ? ???? ??? ??? ??????? ?? ???? ?????? ????????? include ? ???????? ??????? ??? # ? ??????? < > ? ???? ????? ??? ??????? ??? ????? ???? ???? ?????? ??? ????????, ? ???? ??? ??????? ??????? ???? ???????? ?? ??? ???? ??? ?????? ??????? iostream.h ??? ???????.
????
?? ??????? ??????? ??????????
??????
?? ????? ?????? ????????? Key Word ???? ??? ???? ??????? ???? ????? ????? ?? ??? ??????? ?? ???? ????? ???? ????? ?? ??? ?????, ???? ????? ??? ??????? ???? ?????? ??? ?????? ?????? ??? ?????, ? ???? ???? ??????? ????? ????? ??? ??? ??????? ????? ?????? ???? ??? ???, ? ????? ??????? ????????? ?? ????? ??????? ???? ???????? ?????? ???????? .
???? ????? 2 ????? ????????, ????? ???? ???? void ? ??????? ( )main ?????? ?? ???? ??????? ?? ??? ????, ? ?? ?? ???? ?? ????? ???? ?? ?? ??????? ( )main ???? ?????? ???????, ???? ??? ???? ????? "?????? ???????" ????? ????? ???? ???? ?????? ( )main ???? ????? ??????? { } ? ??? ??????? ?????? ??????? ( )main ???? ????? ???? ?? ??? ??????? ???? ?????? ????? ??? ?????? ( )main
?? ????? 4 ???? ?????? cout Carry out ? ?????? ???? ?????? ?? ???? ???? ?????? ? ??? ????? ?? ???? ????? ? ??? ?????? ?? ???? ?????? (= ???????) ? ?????? ?? ?????? ?? ???? ????????? >> ??? ???? ????? ? ??? ?????? ??? ?? ?? ?? ????? ???? ?????? ???????? ???????? Double Quotation ????? ??? ???? ????? ??? ?? ?? ?? ?????? By The Name Of ALLAH ????? ??? ?????? ??? ??, ? ???? ?? ???? ??? ??????? >> ?????? ?????? ? ????? ???? ????? ??? ??????? ? ???? ??????? ??? ???? ?????, ?????? ?? ?????
cout<< 5 + 6 ;
????? ??? ???? ????? ???? ????? ????? ? ?? ????? 11. ??? ??????? ???????? ??????? ?? ??? ????? ??????? ?? ?????, ??? ???? ???? ?? ???? ????? ??????? ???? ???? ?? ?????? ????? ?????? ?? ????? ???? ???????? ?? ????? ??????? ??? ?? ??????? ?? ???? ??? ??? ???? ??? ?? ???? ?? ???? ??? ??? ???? ??? ???? ?????? ?? ??? ????.
???? ???? ??? ?????? Ctrl + F7 ???? ???? ????? ???????? ?? ???? ??????? Compiler, ? ????? ????? ?? ??????? ? ????????? ?? ????? ?????? (????? Output) ???? ??? ?? ??? ???? ????? ??? ? ??? ??????? ??? ? ??? ????? ?? ???????? ???? ? ??? ?? ??????? ?????????.
????
?? ??????? ???????? ????????? ? ?? ???? ????? ???? ????????
??????
????? ???????? ?? ?? ???? ???? ?????? ???? ????? ??? ????? ???????, ??? ???? ????? cot ????? ?? cout ? ??? ???? ?? ??? ??????? ???????? ?? ??? ??????? ????????, ??? ?? ????? ??????? ????? ???? ?????? ???? ? ????? ?????? ?? ???? ????? ???????? ?? ??? ???? ?????.
???? ???? ??? ?????? Ctrl + F5 ???? ????? ????????, ????? ?? ????? ???? ?? ?? ???? ????? ?? ?????? ?? ?? ??????? ????? ???? ???? ??? ???? Enter ?????? ??? ???????? ???? ??????? ? ????? ????? ?? ??? ???????? (????? ????? ????????) ??? ????? DOS ? ???? ??? ????? ??????
By The Name Of ALLAH Press any key to continue
?? ??????? Press any key to continue ????? ?? ?????? ??????? ??? ?? ??????? ?? ?????, ????? ????? ???? ??? ???? ??? ???????? ?????? ????? ??? ???:
#include<iostream.h>
void main()
{
cout<<" By The Name Of ALLAH " ;
cout<<" Welcome to C++ ";
}
?? ?????? ? ????? ??? ???????? ? ????? ?? ????? ??????:
By The Name Of ALLAH Welcome to C++ Press any key to continue
????? ???? ???????? ??? ??? ???????, ??? ???? ???? ?? ???? ?????? ??? ???? ????? ????? ??????? ?????? ???????? cout ???? ????? ????? ??? ????? ??????? iostream.h ? ???? ???????? ??? ?? ???? ?? ????? ?????. ?? ??? ?????? ??????? ???? ???? ????? ??????? ? ?????? ??? ??? ?? ??? ??????? ???????? ? ??? ??? ??????! ?? ?? ?? ????? ?????? ??? ??? ????? ??? ????? ??? ??? ?????? ??? ?? ??? ??? ??? ? ?????? ??? ?? ?????? ?? ????? ??? ?????? ??????? ???? ??????? ????????. ????? .. ??? ????? ?? ????? ?? ??? ???? ??? ???? ? ?? ???????? ?? ???? ?????? ?????? ?????, ??? ??? ?????? ?? ???? ?? ???? ??? ??? ????? ?????? ?? ???? ??? ?????? ?? ???? ???????? ??????? n\ (???? ????? ? ????? ?????? ? ??? ?????? ????? n) ?? ???????? ???? ?????? ???????? ?? ????? ?? ???? ????? ???????? ??? ???:
????? ????? ????? ??? ??? :
By The Name Of ALLAH
Welcome to C++
Press any key to continue
???? ?? ????? ?????? ??? ?? ??????? ?????? ??????? ?????? ?? ?? ?????? ???????? ? ?????? ???????. ?? ????? ?????? ????? ???????? ?????? ???????? endl End Line ? ?? ???? ??? ??? ????? ?????? n\ ???? ????? ???? ?? ????? ???? ?????? ?????? ? ??? ????? ???? ?????? ?? ??? ++C ? ???? ?????? ??? ??????? ??? ??? ????.
??? ???? ????? ? ???? ?? ?? ??? ++C ?? ??? ????? ????? ?????? Letters Case Sensitive ?? ???? ???? ??? ?????? ??????? ? ?????? ???????, ?????? ???? ( )main ????? ????? ?? ( )Main ? ?? ????? ??????? ?? ( )MAIN ? ???? ???? ?? ????? ??? ????? ?????
? ??? ?????? ?? ????? ??? ?? ????????
????????? variables ????? 1
????? ???? ?????? ?????? ???? ?????? ??? ????? ?????? ?? ???????? ???????? ? ??? ????????, ? ??? ???????? ?????? ????? ??? ?????, ? ??? ??????? ????????? ????? ??? ???????? ? ??????? ??? ??? ??? ??????? ?????? ???? ????? ????????, ???? ??? ????? ??? ?????? ??? ????? ???????? ? ?????? ???? ??? ????? ??? ????????, ?????? ??? ???? ?? **** ?? ?? ??????? 3 ? 9 ???? ????? ??? ???? ??????, ????? ???? ??? ????? 3 ? ?????? ???? ??? ????? 9 ? ?????? ???? ??? ???? ????? ? ?? 12, ??? ???????? ?????? ?? ??????? ?????????? ?? ????????? ? ?????? ????? ?????? Variables ? ???? ?????????? ??? ????? ??????? ???? ????? ????? ????? ????????, ? ???? ??????? 3 ? 9 ? 12 ????????? ?? ???????? ? ?????? ????? ?????? Data ? ??? ???????? ??? ????? (?????) ???????? ???? ????? ?? ????? ?? ????? ????? ????? ????? (?? ????? ??? ?????? ??????? ???????), ? ????? 5.045 ????? ?? ????? ?? ??? ?? ????? ????? ???? ??? ???? (?? ????? ??? ?????? ??????? ????????), ? ??????? ?? ?? ?????? ??? ???, ? ??? ????? ?? ????? (?????) ?? ??? ??? ????????, ? ?????? ??? ????? ????????? ?? ?????? ??????? ???? ????.
????? ???????? Data Types
???? ????? ???????? ?? ++C ??? ????? : ????? ????? ? ????? ?????
1. ??????? ??????? ?? ????? ???? ?????? ?????? ??? ?????, ? ??? ???? ?????? ????? ++C
int Integer ? ?? ?????? ?????? ??????? ???????, ? ????? 4 ????
short ????? 2 ???? ? ?? ??? int
long ????? 4 ???? ? ?? ??? int
unsigned ????? 4 ???? ? ?? ?????? ?????? ??????? ??????? ??????? ???
signed ????? 4 ???? ? ?? ?????? ?????? ??????? ??????? ??????? ? ???????
char ????? 1 ???? ? ?? ???? ????? ? ????? ? ????? ????? ??????? ????????
float ????? 4 ???? ? ?? ???? ??????? ??? ???????
double ????? 8 ???? ? ?? ??? float ? ????? ?????? ?????? ?????? ??????? ????
long double ????? 8 ???? ? ?? ??? double
2. ??????? ??????? :
? ?? ??????? ???? ???? ??????? ???????? ? ?? :
• ????????? arrays
• ??????? ????????? Linked lists
• ????? Structures
• ?????? Classes
????????? variables ????? 2
????? (?????) ????????? Variables Definition
? ???? ?????? ???? ???? ????? ????? (?????) ????????? ? ??? ??? ???? ???????? ? ???? ???????. ????? .. ????? ??? ???? ??????? ??? ?? ? ???? ????? ????? 7 ????? ????? ???????, ??? ???? ????? ??? ?????(?????) ??? ??? ?????? ?? int ?? short ?? long ???! ?????? ??? ????? 7 ?? ??? ???? ? ??????? ?????? ??? ????? ?? ????? ??????, ?? ????? ?? ??????? double ? float ???? ?? ???? ??????? ??????? ??? ??????? ??? ??????? ??????? ?? ????? ?? ??????? ???? ? ???? ?? ??????? ???????.? ??? ????? ????? ?? ???? ??? ??? ???????? ????? ?? ??? ??????? (? ?? ??? ???????), ????? ?? ????? ???? ???? ????? ????? ????? ????? ????? ??????
int myNumber;
? ???? ????? ??????? ???? ?? ????? ??????? ???? myNumber ? ????? ???? ? ?? ?? ????? int ? ??? ????? ????? ??????? ????? ??????? ????????, ????? .. ? ???? ????? ???? ?????? 7 ????? ??? ??????? ? ??? ??? ?? ??? ?????? ???? ???? ?? ??????? ??? ?? ???? ??? ??? ????? ????? ???? ??? ??? ???? ?????? ?? ??? ?? ??? ?????? ???? ?? ? ?? ??? ?? ????? ??? ?????? ??????? ???? ???? ??????? ?????? ???? ???????. ????? ???? ???? ???? ?????? 7 ?? ??? ???????, ??? ??? ??????? ???????? ????? ??????? Assignment Operator ? ?? ??????? = ? ???? ??? ??????? ???? ?????? ???? ??? ?????? ?? ???????(???????) ???? ??? ?????? ? ??? ??? ??????? ??? ???:
myNumber = 7 ;
??? ?? ???? ??? ????? ??????? ?? ????? ?????? 7 ?? ??????? myNumber ? ???? ???? ???????? 7 ?????? ?? ??????? myNumber ? ???? ???? ?? ????? int , ? ?? ??????? ??? ????? ??????? ????????? ???????? ?????? ?????? ????? ???? myNumber ? ?? ????? ?????? int ? ??? ?????? 7 ???:
int myNumber ; // Defined a variable its type is int
myNumber = 7 ; // Put the data 7 in the variable myNumber
???? ?? ????? ???? ??????? ????????? ???? ????? ???? ??? ??? :
int myNumber = 7 ;
? ???? ??? ????? (?????) ????? ? ????? ???? ?? ?? ?? ????.
????
???? ???? ?? ??????? ????? ???? ????? ??????? ????????? ????? ???? ?????? ?????
??????
????? ???? ???????? ?? ????? ?????? ???????? RAM , ????? .. ????? ????? ??? ????? ??????? ????? ???? ???? ???? ?? ??????? ???? 4 ?????? ????? ?????? ?? ????? int ? ??? ?????? 7 ? ??? ?????? ??? ?? ???? ????? ?? ?? ????? ?? ??? ????? ?? :
• ??? name : ? ?? ??????? ????? ??????? (? ?? ?? ?????? ?????? ????? myNumber)
• ??? type : ????? ??????? (? ?? ?? ?????? ?????? int)
• ??? size : ????? ??? ??????? (??? ?? ????? ?? int ??? ????? ?? 4 ????)
• ???? value : ????? ?? ??????? (? ?????? ???? ??????? ??? ?? 7)
• ????? address : ?? ??? ?????? ? ?? ????? ??? ????? ?? ??????? ???? ????? ???? ???????.
????????? variables ????? 3
????? ???? ? ???? ???? ?????? ?? ??????? ?? ?????? ???????, ??? ???? ???? ????
????? ???????? ???? ???? ?????, ? ?? ?? ????? ???? ???? ?????? ???????? ???? ????? ??? ??? ??? ???? ??????? ? ???????.
????? ???????
????? .. ????? ???? ???? ?????, ???? ??? ????? ??? ????? ??????? ???? ??? ?? ?? ???? ????? ??? ???? ??? ? ???? ?? ??????? ???? ?? ????? ?????? ?? ?????? ?? ????? ??? ??? ?????? ????? ???, ? ??? ???? ???? ?? ???? ???? ????? ??? ?????? ????? ??????? ???????? cout ???????? ?? ????? ????? ??? ?????? ? ??????? ????? ??? ??????? iostream.h ??? ????????, ? ???? ??? ?? ???????? :
1 #include<iostream.h>
2 void main()
3 {
4 int num1 ;
5 int num2 ;
6 num1= 5 ;
7 num2= 4 ;
8 cout<<"The result of the addition is : " ;
9 cout<<num1 + num2<<endl;
10 }
??? ????????
?? ?? ?? ??????? 4 ? 5 ?? ????? ??????? ????? ???? ??????? num1 , num2 , ? ?? ??????? 6 ? 7 ?? ????? ??? ????? ??? ????????? ? ??????? ?? ??? ?? ??????? ?????? ? ?? ??? ????? ??????, ?? ????? 8 ???????? ???????? cout ?????? ??????? ???? ??? ?????? ???????? ? ????? ??? ??????? ??? ??? ?? ???? ????? ? ???? ?? ??? ?????? ????? ???? ?? ?????? ??? ????? ????? ??? ????? 9 ? ??????? ????? ????? ???? ??????? ???????? ???????, ?? ????? 9 ???? ???? ??????? ???????? ?? ????????? Num1 ? num2 ???? ???? ???? ???? ????????? ? ??? ???????? ? ?? ?? ??? ??????? ???? ????????? ?? ????? ???? ? ?? ??? ?????? ??? ?? ??? ???? ?? ?????? ?? ??? ?? ????? ?????? ?? ????????? ???? ??? ??? ????? ? ??? ?? ????? ??????, ??? ???????? endl ??? ???? ?????? ???? ? ??? ????? ????? ???? ?????? ??????? ??? ????? ????? ??????
? ?????? ??? ????? ??? ???????? ???? ????? ?????? :
The result of the addition is : 9
Press any key to continue
????? ???????? - ??????? ??????
?? ????? ??? ??????? ???? ?? ?????? ??? ?????? ++C ?????? ???????? ? ?????? ??? ??????? ????? ????? ????? ? ???? ????? ??? ???????? ?? ?????? ?? ????? ??????? 4 ? 6 ? ??????? ???? ???? ??? ??? :
int num1 = 5 ;
??? ?? ???? ???????? ??? ???? ????? ?????? ??????? 5 ? 7 ???? ???? ??? ??? :
int num2 = 4 ;
????? ??????? 8 ? 9 ???? ?? ???????? ?? ??? ???? ??? ??? :
cout<<"The result of the addition is : "<< num1 + num2 <<endl;
?? ??????? ?? ????? 9 ?? ?????? ????? ?????? ??? :
cout<<num1 + num2 ;
cout<<endl;
???? ???? ???????? ?? ?????? ?????? ????? ????? + ???? ???????, ???? ??? ??????? ?? ++C ???? ????? ????? ? ????? ++C ??? ???? ?? ????? ????????? ???? ?????? ?? ?????????, ? ??? ??? ?? ????? ?? ??? ?????????, ????? ?????? ???????? ????? ????? ???????.
????? ???????? - ??????? ???????
????? ???? ???? ????? ???????? ?? ???? ????? ???????? ?? ????? ??????? ?????? ????? ?? ???? ????????, ? ??? ??? ?? ???? ???????? cin Carry in ? ???? ???? ?????? ?????? ??????? ?? ???? ???????? ? ?? << ? ??????? ???? ?????? ??????? ?? <<cin ? ?? ???? ???????? ?? ????? ????? ??? ?? ??? ??? ??????? ?????? ?????? ??? ????? ??????? ????? ??????? ;cin>>num1 ? ???? ???? ???????? ????? ??????? ??? ??? :
1 include<iostream.h>
2 void main()
3 {
4 int num1 ;
5 int num2 ;
6 cout<<"Enter the first number\n";
7 cin>>num1 ;
8 cout<<"Enter the second number\n";
9 cin>>num2 ;
10 int total;
11 total=num1+num2;
12 cout<<"The result of the addition is : "<<total<<endl;
13 }
????? ???? ?????? ??????? num1 , num2 ?? ????? ????? ???? ?? ???????? ?? ???? ????? ????? ? ?? ????? ?????? ????? ???????? ???? ???? ???????? ?? ????? ????? ?????. ????? ??? ????? ???????? ???? ????? ??? ????? 7 ??? ???? ???????? ?????? ????? ????? ? ??? ????? ???? ????? ???????? ??? ????? enter ?? ???? ???????? ?????? ???????? ????? ????? ? ????? ???? ??? ????? 9 ??? ???? ???????? ?????? ????? ?????? ? ????? ???? ???????? ????? enter ???? ????? ???????? ??? ???????. ???? ?? ????? 10 ???? ????? ????? ??? ?? ??? ??? ???? ??? ????????? ????????, ? ????? ???? ?? ????? ??????? ?? ????? 11 ?? ??? ????? ??????? ???? ?? ????? ?????? ?? ??????? ???? ?? ????? ??????, ????? ???? ??? ??? ???????? ?? ?? ?????? ?????? (???? ?? ????? ?? ????????) ????? ??? ??????? ???????? ??????? ??? ?????? ???????? ????????, ???? ?? ????? ???????? ?????? ???? ??? ????? ??? ????? ? ????? ???????? ??? ???????? ??????? ??? ???:
1 #include<iostream.h>
2 void main()
3 {
4 int num1 , num2 , total ;
5 cout<<"Enter the numbers to addition\n";
6 cin>>num1>>num2 ;
7 total=num1+num2;
8 cout<<"The result of the addition is : "<<total<<endl;
9 }
? ??? ??? ????? ?? ???? ??? ??????? ???? (????? ??????? ??? ????? ? ??? ??????) ? ?? ????? ??? ??????? ??? ?? ???? ????????? Comments ??? ??? ????????, ?? ?? ??????????
????????? Comments
?? ????? ????????? ?? ?? ???? ???????? ???? ????? ? ???? ??? ??????? ??????? ???????, ? ??????? ?? ???? ??? ????? ??? ?? ??????? ?? ??????, ? ??? ???? ??????? ???? ???????? ??? ???? ??????? ? ??? ????????, ?????? ??? ???? ??? ???????? ?? ??? ??? ? ?????? ??? ????? ?? ??? ?? ????? ???? ??? ??????? ?? ??? ?????? ?? ??? ??????? ? ?????? ????? ???? ???????? ?????? ? ???? ?? ??? ?????, ???? ????? ????? ????????? ??? ???????? ?? ??????? ???????? ?????? ????? ???????? ???? ????? ? ??????. ??? ????? ????????? ??? ???????? ???????? :
• ????????? ??????? : ? ?? ????????? ???? ?? ?????? ????? ????? ??????, ? ??? ????? ??????? ?? ???? ??? ??????? // ?? ???? ????? ???????, ????? ??????? ?? ?? ??? ??? ??????? // ? ?? ??? ????? ????? ??????? ???? ?? ????? ??? ??? ?????? ? ?? ????? ??? ?????.
• ????????? ?????? ?????? : ? ?? ????????? ???? ????? ??? ???? ?? ??? ???? ? ??? ????? ??? ????? ?? ????????? ?? ???? ??? ??????? ??????? /* ... */ ??? ?? ?????? ?????? ???? ??????? ???? ??????.
? ???? ????? ???????? ?? ???? ??????? :
/* This program is for addition
two numbers and put the result in the variable total,
it's the final form, at first read it carefully, then execute it
*/
#include<iostream.h>
void main()
{
//Declaration of the variables
int num1 , num2 ; //these variables for put the numbers in them
int total = 0 ; /* this variable is for put the result of addition in it,
note that we put the value zero in it. */
cout<<"Enter the numbers to addition\n";
cin>>num1>>num2 ;
total=num1+num2;
cout<<"The result of the addition is : "<<total<<endl;
????????? Operators
????? C++ ??? ????? ????? ?? ????????? Operators, ? ????????? ?? ???? ???? ?????? ?????? ?????? ??? ????????? ????? ??????? ????? ????????? ???????? ? ???? ????????? ???????? ..???, ? ??? ?? ?????? ?? ?????? ??????? ?? ????? ????? ? ????? ???????, ? ?????? ???? ???? ???? ????? ??? ????? ??? ?????????, ? ??? ??? ????? ????? ?? ????? ????????? ??????? A = 5 ? B = 3 ? C = 10 ? R ???? ???? ??? ???????, ??? ????? ?????? ??????? ?????.
???? ?? C++ ???? ??????? ?? ????????? ????? ??? ??????? ???? ???? ??? ? ??:
1. ????????? ???????? Mathematics Operators :
??? ??????? ???? ?????? ????
????? + ???? ???? ??????? ??? ????? R = A + B è R = 8
????? - ???? ???? ????????? R = A – B è R = 2
????? * ???? ???? ????????? ?????? ????? R = A*B è R = 15
?????? / ????? ?????????* R = A/B è R = 1
???? ?????? % ?????? ???? ???? ????? ?????? ????? R = A%B è R = 2
????? ??????? = ??????? ??????? ???? ???? ??? ????? ???????
????? ??????? ( ) ?????? ?????? ?????? ?????? ???????? R = (A+B)*C è R = 80
* ?? ??? ?? ??????? ????? ?????? ?