I been at it for hours now trying to figure out why my code isnt letting me renter in my name after I say I want to register again heres the code:
#include <iostream>
#include <string>
using namespace std;
int main() {
string full_name{};
string answer{"yes"};
while (answer1 == "yes" || answer1 == "Yes") {
string answer{};
cout << "Type your full name with a space inbetween: ";
getline(cin, full_name);
cout << full_name << " has been registered" << endl;
cout << "Do you want to clear your name from the list :";
cin >> answer;
if (answer == "yes" || answer == "Yes") {
full_name.clear();
}
else if (answer == "no" || answer == "No") {
cout << "Your name is still in the list" << endl;
}
cout << full_name << endl;
string answer1{};
cout << "\nDo you want to register again or someones else name?" << endl;
cin >> answer1;
cout << endl;
if (answer1 == "no" || answer1 == "No") {
cout << "Thank you for registering" << endl;
break;
}
}
}
When I say yes to cout << "\nDo you want to register again or someones else name?" << endl;
it loops back up but skips cout << "Type your full name with a space inbetween: "; getline(cin, full_name);
I provided images of what I meanenter image description here