+ 2

assign a value

How to assign a value to a variable from user input

1st Mar 2020, 5:33 PM
Harry Young
Harry Young - avatar
4 Réponses
0
for example....if you want to read a number from user cout<<"enter your number"; #takes the input from the user and stores it in n cin>>n ;
2nd Mar 2020, 7:11 AM
Navya Vejalla
Navya Vejalla - avatar
0
//Declare a variable int x; cin>>x; //assign value
2nd Mar 2020, 8:06 AM
Swapnil Vishwakarma
Swapnil Vishwakarma - avatar