LECTURE 2
LECTURE 2
PROGRAMMING PRINCIPLES
CODE: ITU07112
LECTURE 2
Key features of C++
C++ is:
• Free-format, i.e., there are few restrictions on the
appearance of the program.
• Case-sensitive.
• Compose of one or more functions and thus supports
structured programming.
• Supports Object-oriented programming methodology.
• Portable as it is available in all platforms, i.e., for all
operating systems.
STRUCTURE OF A C++ PROGRAM
The following example illustrates the structure of a C++ program.
#include<iostream>
using namespace std;
int main()
{
cout<<"Welcome to C++"<<endl;
return 0;
}
Key features of C++ cont…
i. Comments:
Comments are used for better understanding of the
program statements. The comment entries start with a //
symbol and terminated at the end of the line. In Program
above the lines are comment lines.
int Integers
char Character.
#include<iostream>
Using namespace std;
Int main()
{
int number1;
Int number2;
Int sum;
cout<<“Please enter first number”<<endl;
cin>>number1;
cout<<“Please enter second number”<<endl;
cin>>number2;
Sum=number1+number2;
var1 = 10;
var2 = var3 - var1;