How we can take input in c++


It is very easy to know that we use key word cin for input with double angle brackets >>. For input we use iostream header file. For input we simply use any data type for example int , float , string , or double etc and make object of that data type and than input that object. If we use int data type than we can write int number not float number and if we use float data type than we can enter integer number or decimal number etc. In string data type we can input number or name or special symbols etc.

Code:

#include <iostream>
using namespace std;
int main() {
 int num;
 cout<<"Enter a number : ";
 cin>>num;
}

So, we can make simple input in c++ by this code.

Click Here For Watching The Video Of That Code

avatar
AUTHOR: Muhammad Abbas
I am Software Engineer.

0 Comments