C++ program to accept input and display output?
1
In C++ cin keyword is used to accept input and cout keyword is used to print the output.
To accept the input : cin<<
To display the result/output : cout<<
C++ program to accept input and display output:
Example:
#include<iostream.h>
#include<conio.h>
void main()
{
int age;
cout<<“Enter your age --”<<endl;
cin>>age;
cout<<“your age is : ”<<age<<endl;
}
Output:
Enter your age --
16
your age is : 16
Note : Here endl keyword has used to change the new line.