I've been having trouble figuring this out for a while now. I keep having issues with my if/else if statements. In my program, I'm trying to loop a list of customer for a telemarketer to read off of and record the call information into another document. I'm only having two issues that I believe are relatively small and minor but I can't figure it out with my google fu.
Here's my code:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
    char stat, answ;
    float rate;
    string fname, lname, phone, address;
    ifstream potentials("C:\\Users\\Brandon\\Desktop\\C++Projects\\Lab6\\potentials.txt");
    ofstream results("C:\\Users\\Brandon\\Desktop\\C++Projects\\lab6\\results.txt");
    if (!potentials) {
        cerr << "Unable to open file";
        exit(1);
    }
    while (!potentials.eof())
    {
        potentials >> stat >> fname >> lname >> phone;
        if (stat == 'X')
        {
            cout << "customer is preferred\n";
            rate = .079;
        }
        if (stat != 'X')
        {
            cout << "Customer is not preferred\n";
            rate = .129;
        }
        cout << fname << " " << lname << " " << phone << " " << rate << endl;
        cout << "Is this customer interested in this card? Y or N" << endl;
        cin >> answ;
        if (answ == 'Y')
        {
            cout << "Thank the customer and ask for their current address.\n";
            cin >> address;
            cout << "Thank the customer for accepting the offer, to expect a card in the mail soon, and happy charging!\n";
            results << fname << " " << lname << " " << stat << " " << address << " \r " << endl;
        }
        if (answ == 'N')
        {
            if (stat == 'X')
            {
                cout << "Tempt them with the cash back rewards and to call 18003838383 for a better offer.\n";
                results << fname << " " << lname << " " << answ << " " << address << " \r" << endl;
            }
            else if (stat != 'X');
            {
                cout << "Tell them thank you anyhow and to have a nice day.\n";
                results << fname << " " << lname << " " << answ << " " <<
                    address << " \r" << endl;
            }
        }
    }
}
Problem number 1:
For the address portion, I keep getting an error where if I include a normal address such as 123 w main st. That type of address will weirdly complete the loop. Like [so][1]. I don't know and understand why that happens. It will compile and execute just fine if I just put a number.
Problem number 2:
If the customer proceeds to call and decline the card, both the if statement and the else if statement will execute:
customer is preferred
Joe SCholz 437-4798 0.079
Is this customer interested in this card? Y or N
Y
Thank the customer and ask for their current address.
123 W Main St
Thank the customer for accepting the offer, to expect a card in the mail soon, and happy charging!
Customer is not preferredTim Wade 768-7658 0.129
Is this customer interested in this card? Y or N
customer is preferredSara JObs 326-7857 0.079
Is this customer interested in this card? Y or N
Customer is not preferredJaynce Bee 354-8678 0.0129
Is this customer interested in this card? Y or N
I don't understand this part either because the if statement should execute. If the customer doesn't have an X on their status in the file, then it should automatically go to the else if statement. Instead it executes both the if and the else if statement and I can't seem to figure out as to why that happens.
These are the only two things holding me back and I can't figure out both of them.
 
     
     
    