0

If i have given serie of numbers separated by spaces, for example: INPUT 1 5 8 4

How can i save these integers in 4 diferent variables for each one? like:

x= 1;
y=5;
z= 8;
a= 4;
  • 2
    How about `std::cin >> x >> y >> z >> a;`? (Should be part of your teaching book.) ;-) – Scheff's Cat May 11 '22 at 16:55
  • 1
    The answer to all "no idea how to start" questions is: "read, find working examples, try, fix, redo". I.e. read some text book or tutorial, find a HelloWorld or sample code, try to change it in small steps towards your goal, test, debug; then try the next iteration. Once you got something and it does not work for the very small change you made away from something working, then it is time to ask a focused question here, according to [ask] and maybe using the compromise described here: https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions – Yunnosch May 11 '22 at 16:58
  • When the topic of "multiple variables" comes up, give `std::vector` a review. – Thomas Matthews May 11 '22 at 17:14

0 Answers0