I'm trying to take one line of input separated by spaces and assign it to four variables.
I read that you're meant to be able to do:
For input: 12345 string 4 5
cin >> i >> s >> n1 >> n2;
i = 12345, s = string, n1 = 4, n2 = 5
But I have to press enter for each variable. I need one line to assign to the four variables.
Thanks.
Aucun commentaire:
Enregistrer un commentaire