I'm working on this as a function for a class project, but I can't figure out why the loop won't break when the user enters "N". It just keeps looping no matter what the user enters when asked if they want to continue.
Can someone help me get the loop to break properly? That's the only part of the code that isn't working.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
const string ADDRESS_FILE_NAME = "Address.csv";
int main()
{
string name;
string street;
string city;
string state;
string zip;
char input;
//TODO: Declare variables for name and address fields
ofstream inputAddress(ADDRESS_FILE_NAME);
//TODO: Open address file for output using ofstream()
do{
cout << "Enter name: " << endl;
getline(cin, name);
cin.ignore();
cout << "Enter street name: " << endl;
getline(cin, street);
cin.ignore();
cout << "Enter city: " << endl;
getline(cin, city);
cin.ignore();
cout << "Enter state: " << endl;
getline(cin, state);
cin.ignore();
cout << "Enter zip code: " << endl;
getline(cin, zip);
cin.ignore();
cout << "Enter another address? (Y/N)" << endl;
cin >> input;
cin.ignore();
}while(input != 'N' && 'n');
return 0;
//TODO: Loop to accept and write addresses
// Prompt user to enter name and address fields
// Write entered data to address file separated by commas
// Ask user if more addresses to enter
// Repeat loop while user responds 'Y' or 'y'
inputAddress.close();
//TODO: Close address file
}