"cout" is statement is used to print something on the output screen in C++ language program. now this is a simple example of"cout"statement.
Program:-
#include<iostream.h>
#include<conio.h>
void main(void)
{
clrscr();
cout<<"My name is ammar"<<endl;
cout<<" I live in wah cantt"<<endl;
cout<<" I am student"<<endl;
getch();
}
Output:-
My name is ammar
I live in wah cantt
I am student
Note:-
There is not much difference between "C" and "C++" in syntax as you can see four changes in this program.
- we us ""#include<iostream.h>" instead of "#include<stdio.h> in c++" .
- we use "cout" instead of "printf" in c++ .
- we use endl for new line however you can also use \n in c++.
- we use "<<" instead of parentheses in c++
No comments:
Post a Comment