Help with looping [beginner]
I am trying to make a program that asks you to enter some names and I want that program to loop the same thing until you press "control", then I want it to stop and just output all the names you entered...I made a boolean called exit that is false by default and I thought about something that when you press crtl you set it to be true and then that loop stops and just outputs names...also how to make a variable that can hold a lot of names(if you enter 10 then it will hold 10 or if you enter more it will hold more names in it)...I would be very grateful if someone could help me :wave: ... sorry for bad english, I may have some weird grammar mistakes
Re: Help with looping [beginner]
If you post your existing code, that would be helpful. Use code tags so that the code is easy to read. Go Advanced, select the formatted code and click '#'.
Determining the state of the control key is non-trivial. It would be easier if your loop was terminated by eof (ctrl-z for keyboard input on Windows). To hold an unknown number of names then I would suggest using a vector. See http://www.cplusplus.com/reference/vector/vector/
To enter a name consider using getline(). See http://www.cplusplus.com/reference/s...tring/getline/