Author Topic: Help Please!  (Read 3991 times)

FluFfy

  • Guest
Help Please!
« 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;
}

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Help Please!
« Reply #1 on: November 12, 2010, 12:46:46 pm »
THis is not a general programming forum/website.

Your post violates our forum rules !

Topic locked !