I have written my code, but can't seem to figure out why it doesn't enter the while loop and start asking for Input. Any insight would be greatly appreciated. Just need a direction to go in.
Code:#include <iostream> #include <string> using namespace std; int main() { //declare variables string cityName = ""; string stateName = ""; string zipCode = ""; string fullAddress = ""; string loopValue = ""; cout << "Enter -1 to end or press enter to key in a date: "; getline(cin, loopValue); while (loopValue != "-1"); { cout << "Enter city: "; getline(cin, cityName); cout << "Enter state: "; getline(cin, stateName); cout << "Enter zip code: "; getline(cin, zipCode); fullAddress = cityName + ", " + stateName + " " + zipCode; cout << fullAddress << endl; cout << "Enter -1 to end or press enter to key in a date: "; getline(cin, loopValue); } cin.get(); return 0; } //end of main function




Reply With Quote