with all 16 to 17 posts of theory , here is the time for your first simple C++ program.......
Suppose we want to display message "My name is jonty , many greetings to you" on the video screen..... Write the following statement on the C++ screen :
# include
void main () // program heading
{ //begin
cout<< "My name is jonty , many greetings to you";
} // end
The function main() must be placed before the begin statement. It invokes other functions to perform its job. The symbol "{" is used as a begin statement .... The declaration of variables and the type of operations are placed after the begin statements .... The end statement is denoted by the symbol "}" . In C++ , the semicolon ";" work as a statement terminator rather than a seperator......
Statements that are terminated by a semicolon are grouped within braces {........}. Most statements contain expression , sequences of operators , function calls, variables and constants that specify computation....
Variables and function names are of arbitrary lengths and consists of upper and lower case letters , digits and underscores and they may not start with a numeral... All C++ keywords are written in lowercase letters....
Any statement or function within comments are not executable and they are ignored by the compiler... The comments are specified in the following way..... In old C style it is like /* this is a test */ But in C++ style it is written as // this is a test
// this is a new style of C++ style of remark statement......
That's all for today ..... we will begin our topic further on my next posts.......
0 comments:
Post a Comment