0
how do I assign a word to a cin variable
I know how to do int c and then do cin >> c but how do I make c a word.
5 odpowiedzi
+ 3
kyle here is a quick code as Jayakrishna🇮🇳 pointed out:
#include <iostream>
using namespace std;
int main() {
int x = 24; string y = "Stan"; string z;
cin >> z;
cout << y << " is " << x << " years old and his friend " << z << " is too" << endl;
return 0;
}
+ 1
Same way..
string c;
cin>>c;
c++ have string datatype which c don't have.
+ 1
Wow this is from 9 months ago and now I feel I was stupid asking that question now that I've completed c++
+ 1
kyle that is growth from crawling to running ..
+ 1
Yes...