0

What is the command to declare a string data by human like cin>>a; but when a is a string?

1st Aug 2016, 11:20 PM
Isembart
Isembart - avatar
4 Respostas
+ 2
Just use getline(cin, a);
2nd Aug 2016, 12:33 PM
Cohen Creber
Cohen Creber - avatar
0
I think... While declaring we have to give String a; //string is a built data type And now we can get the string from user as human in runtime
2nd Aug 2016, 1:45 AM
balaji
balaji - avatar
0
hello @balaji. string is not a default data type. you have to declare a character array and use gets () under the string.h directory or stdio.h or stdlib.h I don't remember which one it is.
2nd Aug 2016, 1:51 AM
Shubhranil Chakraborty
Shubhranil Chakraborty - avatar
0
u are correct @shubhranil but string is a built in data type that can be also accessed by giving "string a("characters")"
2nd Aug 2016, 10:31 AM
balaji
balaji - avatar