How to get user input in C++?
Here you need to use IOStream function
CIn >>CIn is used to get input from the user but before it, You need to declare a variable in which you can serve your user value.
Note: "using namespace std" is important to add. It is used to add standard functions.If you are thinking about
<<So it is used as concatenation like in PHP dot operator performs
/*
Name: cin function in C++
Copyright: sameearticles.blogspot.com
Author: Samee Ullah Feroz
Date: 26/01/14 23:39
Description: How to get user input in C++?
*/
#include <iostream>
int main() //it is actually a function here
{
using namespace std;
int saminum; //we need to daclare a variable....
cout << "What is your age?" << endl; // << is as concatination remind it.
cin >> saminum;
cout << "My age is = " << saminum << "\n";
saminum = saminum + saminum;
cout << "double is = " << saminum << endl << "Enter to close it.";
system("pause");
return 0;
}
Post a Comment
Give your reviews about this blog. Leave your comments. what do you think about this post?
Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.
---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards