pre-test while loop

I have the main part of this program done all i need to do is add a while loop that repeats input and output and then when the user inputs Q the program ends
here is my code:

#include <iostream>
#include <string>

using namespace std;

int main()
string fullName;
cout << "Enter your full name (first middle last): ";
getline(cin, fullName);

int space = fullName.find(" ");
int fullLength = fullName.length();

string firstName = fullName.substr(0, space);
int firstLength = firstName.length();

string second = fullName.substr(space + 1, fullLength - firstLength);
int secondLength = second.length();

int secondSpace = second.find(" ");

string middleName = second.substr(0, secondSpace);
int middleLength = middleName.length();

string lastName = second.substr(secondSpace + 1, secondLength - middleLength);

string finalName = lastName + ", " + firstName + " " + middleName.substr(0, 1) + ".";
cout << finalName<< endl;

while (
return 0;

closed account (3qX21hU5)
So what do you need help with? How to get the while loop to run? How to determine when Q is entered? Need a question in order to help you.

Also when posting your code please use code tags (Hint the <> off to your right when you are replying)
Topic archived. No new replies allowed.