Code::Blocks Forums

User forums => Help => Topic started by: FluFfy on November 12, 2010, 11:20:25 am

Title: Help Please!
Post by: FluFfy on November 12, 2010, 11:20:25 am
I don't know why the program doesn't recognize 'n' or 'N'
sorry i'm really a newbie in programming





#include <iostream>

using namespace std;

int main()
{
    int a=0;
    char b;

    cout << "Load:" << endl;
    cin>>a;

    do
    {
        cout<<"Send Text?(Y/N)"<<endl;
        cin>>b;

            if(b=='y' || b=='Y')
                {
                    if (a>0)
                    {
                        cout<<"Message Sent!"<<endl;
                        a--;
                    }
                    else
                    {
                        cout<<"Message Failed!"<<endl;
                    }
                }
            else if (b!='n' || b!='N')
                {
                    cout<<"You can only enter Y or N"<<endl;
                }
    }
    while (b!='n' || b!='N');

    cout<<"The remaining load is "<<a;

    return 0;
}
Title: Re: Help Please!
Post by: Jenna on November 12, 2010, 12:46:46 pm
THis is not a general programming forum/website.

Your post violates our forum rules !

Topic locked !