Computer Programming 1 CPP - Week2
Computer Programming 1 CPP - Week2
COMPUTER PROGRAMMING I
1. #include<headerfile>
2. return – type main( )
3. {
4. executable – statements;
5. }
Explaination
#include<iostream>
Int main ( )
{
//prints “Welcome to C++ class!”
cout<< “Welcome to C++ class! \n”;
}
Explaination
#include<iostream>
int main()
{
//prints “welcome to computer science department!”
cout<<”Welcome”<< “to”<< “C++”<<”Class!”<<endl;
}
CHARACTERS AND LITERALS
Variable = expression;
First, the expression is evaluated and then the
resulting value is assigned to the variable. The
equals sign “=” is the assignment operator in C++.
int number1;
cin >> number1;
is executed, the characters typed by the user
are converted to an integer that is placed into a
memory location to which the name number1
has been assigned by the C++ compiler.