0

Can anyone tell me how to input a string by user and store it in a variable?

please someone tell me (cpp) i want to input a string by user and store in string type variable, can i do?

13th Oct 2021, 4:13 PM
DHARMANDER YADAV
DHARMANDER YADAV - avatar
2 Answers
+ 3
#include <iostream> using namespace std; int main() { //declaring string type variable string str; //taking input by user getline(cin,str); //printing inputted string cout<<"your string: "<<str; return 0; }
13th Oct 2021, 4:27 PM
Rupali Haldiya
Rupali Haldiya - avatar
+ 1
Rupali thanks a lot dear🙏🙏
13th Oct 2021, 4:37 PM
DHARMANDER YADAV
DHARMANDER YADAV - avatar