Since the very first time I programmed c++ I've been trying to make a program that looks like this

#include <iostream>

using namespace std;

int main()
{
    char name;
    cout << "please type in your name >> ";
    cin >> name;
    if(name == 'kevin'){
            cout << "hello bitch" << endl;
            }
            else{
                 cout << name << ", what a lovely name" << endl;
            }
    cin.get();
    cin.get();
    return 0;
}

the only problem is that the char operator only reads the first sign, so if i type in kevin it only output "k, what a lovely name"

if i cange the program to this

#include <iostream>

using namespace std;

int main()
{
    char name;
    cout << "please type in your name >> ";
    cin >> name;
    if(name == 'k'){
            cout << "hello bitch" << endl;
            }
            else{
                 cout << name << ", what a lovely name" << endl;
            }
    cin.get();
    cin.get();
    return 0;
}

and then type in k, it will say hello bitch, if I try to change the char name; to char name[30]; I receive a error message saying "[Warning] character constant too long for its type " and "ISO C++ forbids comparison between pointer and integer "

is there any way i can get this thing working?:?:

Three small changes :

1>Use #include<string> in the beginning
2>Take name as

string name;

rather than char name.
3>Use "kevin" rather than 'kevin' in the check.

@skydiploma:

The "==" comparision for strings given in namespace std is given only for strings of class string.

@KangarooBlood

Make the changes given in post #3 it will work.

And ya don't use abusive words on the forum please.

Comments
I almost forgot that It was a c-styled string.

Three small changes :

1>Use #include<string> in the beginning
2>Take name as

string name;

rather than char name.
3>Use "kevin" rather than 'kevin' in the check.

Thank You, at last it works!!!

@skydiploma :

Use the function strcmp(char ,char)

Missing out on several things today ha buddy ???
Its strcmp(char *,char *) for strings. ;)

Well it seems that "today is not my day" .

Maybe its because of my anticipation towards the Wimbledon final. I am a big Roger Federer Fan!!

However I just realised that it is

strcmp ( const char * , const char *);
This question has already been answered. Start a new discussion instead.