Okay well i am just experimenting with C++. I am writing a DOS based program and I am having difficulties getting this if statement to work.
Okay what I want to happen is that when you enter bob it will say "u suck" and if you type in anything else it will say "u rule" and the name typed in.Code:#include <iostream.h> int main() { char name[30]; char bob[30]="bob"; cout<<"Please enter your name: "; cin>>name; if (name == bob) { cout<<"U Suck"<<endl; } else { cout<<"You Rule"<<name<<endl; } return 0; }
Im sure this isnt a hard thing to do so any help is greatly appreciated.