I just started learning c++ a few days ago and have come across a problem I can't seem to find a solution to. I figure one of you people with lots of experience well go "oh yah that's easy put such and such here and wala!" Anyway I am trying to make a program that asks you for a password and if you get the password right it says something and if you get it wrong it says somethings else. I have applications for this later down the road, but for right now I am starting simple.
Here is what I have so far...
#include <iostream.h>
#include <string.h>
int main()
{
char t[5];
cout<<"enter password: ";
cin.getline(t, 5, '\n');
if (t=="trey")
{
cout<<"you are a god"<<endl;
}
else
{
cout<<"you got it wrong! Haha!"<<endl;
}
cout<<"you entered: "<<endl<<t<<endl;
cout<<"the answer was trey"<<endl;
cin.get();
return 0;
}
I know I need to do something in line 8, but what I know not...If someone could help me I would greatly appreciate it.
Thanks in advance,
Trey