Q:

C++ Averaging program not calculating average after pressing n to escape do while loop

I'm trying to make a simple averaging program in C++ but it doesn't seem to be working right. I loop throw asking for a number and then ask if the user has another number to enter. When the user needs to type y or n for whether or not they have another number, saying n or N doesn't exit the loop like it should. It just goes right back up to the top and asks for another number again. Why is it doing this?
My Code: 
#include <iostream>
#include <string>

using namespace std;

int main() {
    double total = 0;
    double average = 0;
    string choice;
    double input = 0;
    int numbersEntered = 0;

    do {
        cout << "Enter a number: ";
        cin >> input;

        total += input;
        numbersEntered++;

        cout << "Do you have another number to enter? (y/n)";
        cin >> choice;
    } while(choice.compare("n") != 0 || choice.compare("N") != 0);

    average = total / numbersEntered;

    cout << "Your Average is: " << average << endl;

    return 0;
}

A:

Your while loop says 'carry on if the user has not put "n" OR has not put "N".' Put another way, it will only stop when the user has put both "n" and "N" at the same time, which is impossible! Change that "or" to an "and":
while (choice.compare("n") != 0 && choice.compare("N") != 0)

Or simply:
while (choice != "n" && choice != "N")

Edit: probably clearer to put the not entirely outside the condition:
while (!(choice == "n" || choice == "N"))

