C++ | How to get user input in C++? Lecture 3

user input

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;  
   }  

Share this article :

Post a Comment

Give your reviews about this blog. Leave your comments. What do you think about this post?

Comments Guidelines:

1) I love to read comments, but please avoid spam.

2) Like this blog, share your insights, and spread the word.

3) You can use basic HTML/xHTML tags.

4) All comments are DoFollow—please use the section professionally.

5) Kindly mention your name or brand below your comment.

6) Constructive suggestions for improvement are always welcome.

7) Do not forget to explore our main agency platform at pingbooster.site.

Thanks for visiting Samee Articles.

========================================

Explore custom digital solutions and WordPress plugins at PingBooster Plugins.

Best Regards,

Samee U. Feroz

 
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger