How to put a string in a WHILE loop

How do I put a string in a WHILE loop. I'm practising, and I decided to try and make a register.

string firstName;
string lastName;

cout << "Enter name of student :" << endl;
cin >> firstName;
cin >> lastName;


int i = 0;
while()
{

cout << firstName + " " + lastName;
if (i == 30)
{
cout << "End of register" << endl;
}
}

I have a guess of what you're going for, but I think it would be better if you asked a more specific question. A while loop has two parts: The logic inside of the loop, and the condition (a boolean expression) that the loop loops on.

Start with this: What do you want the while loop to do?
Last edited on
Topic archived. No new replies allowed.