Write a program which take a sting from used and later display on screen i want it in easily manner | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program which take a sting from used and later display on screen i want it in easily manner

19th Dec 2016, 4:49 PM
Raja Moeez
Raja Moeez - avatar
2 Answers
0
#include<iostream> #include<cstdlib> using namespace std; int main() { string mystr; getline(cin,mystr); cout<<mystr<<endl; return 0; } if we take directly the input using cin....it considers only till the occurance of first whitespace...Inorder to avoid that, we will use getline...
19th Dec 2016, 4:58 PM
Manikanta Nallamalli (Mittu)
Manikanta Nallamalli (Mittu) - avatar
0
you can also use cin to take an input from user and stores it in a string variable
19th Dec 2016, 6:20 PM
Fluffy Rabbit
Fluffy Rabbit - avatar