this doesn't seem to work
a while ago someone helped me make a pig latin program. I took his suggestions and created myself. I'm trying to make an easter egg so that when you enter my girlfriends name it outputs "I love you". For some reason, when i put her name in, it seems to skip over the if statement i used? It compiled fine. Can someone tell me what's wrong with this?
Code:
#include<iostream.h>
main()
{
while (1)
{
char a,b,last;
char name[255];
cout<<"Enter a name ";
cin>>a;
cin>>last;
cin>>name;
if (a=='R'&&last=='e'&&name=="ggie")
{
cout<<"I love you";
}
cout<<last<<name<<a;
cout<<"ay\n";
cout<<"Do you want to continue? Y or N ";
cin>>b;
if (b=='N' || b=='n')
{
return 0;
}
}
}
Re: this doesn't seem to work
Code:
if (a == 'R' && last == 'e' && name == "ggie")
You are using c-strings, you can't use ==, use strcmp()