I've been trying to figure out this problem for a week.
I've searched all sites for if else statements, and I can't figure out why !!!!!!!!!!!!!!!!!
What's wrong with my statements ??
Help me out !!!!!!!!!!! please.

#include<iostream>
#include<string>
using namespace std;

void main()
{
    char hsg;   //Highschool Graduate
    char hs=0;  //Highschool Student
    string prince;  //Pricipal

    do{
        cout << "\n" << "Are you in Highschool now ?(y or n) : ";
        cin >> hs;

        if(hs == 'y')
        {

[COLOR="Red"]Problem Start from here :[/COLOR]

            do{
                cout << "\n" << "Do you have principal's permission ?(y or n) : ";      
                cin >> prince;

                if(prince == 'y')
                {
                    cout << "Then, you are able to take class.\n";
                }

                else if(prince == 'n')
                {
                    cout << "Bring the permission letter from your Pricipal.\n";
                }
            }while(!(prince == 'y' || prince == 'n'));

[COLOR="red"]Problem Finish here :[/COLOR]

        }

        else if(hs == 'n')
        {
            cout << "\n";
            cout << "Are you a Highschool Graduate ?(y or n) : ";
            cin >> hsg;
        }
    }while(!(hs == 'y' || hs == 'n'));
}

Looks like prince is a string and you're comparing it to a character? Use double quotes rather than single quotes.

That was keeping it from compiling; was that all you wanted help with, or did you need help with the logic also?

LOL what a stupid mistake !!!!!!!!!!
Thanks !!!!!!!!!!!!!!!
Really !!!!!!!!!!!!!!!!!!

No problem, it's late. Don't forget to mark the thread as solved so you don't get a hundred more replies with the same answer. A +1 wouldn't be so bad either :) lol

How do I mark the thread as solved ?
I'm newbie.......... lol sorry.

At the bottom of the thread, beside the big yellow "Reply to this thread" button there should be text to the right of it that says "mark as solved."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.