Take number from user input
User input:
In this example of c++,taking number from the user as input.here is the code of this problem taking input.
code:
#include<iostream>
using namespace std;
int main()
{
char ch; //declare variable of character
cout<<" enter the any character"<<endl; //message for taking input
cin>>ch; //take input
int main()
{
char ch; //declare variable of character
cout<<" enter the any character"<<endl; //message for taking input
cin>>ch; //take input
//display enter character
cout<<ch;
return 0;
}
Output:
enter the any character
h
h
In this code, take input from the user through in and store in the ch variable.
Then use this ch variable to display on the screen.
Comments
Post a Comment