I just started learning C++ last week. I'm trying to write a simple code using if and else statements, apparently there is an error in my code and I can't identify it. Any help would be appreciated. And yes I tried google.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
#include <string>
usingnamespace std;
int main ()
{
cout << "What is your name? ";
char name [9];
cin >> name;
if (name == steve)
{cout << "Welcome Boss\n";}
else
{cout << "Fuck off\n";}
return 0;
}
I would also start with your basic data types, such as int, string, char, bool, and not container objects (even though string is a container, and you'll learn why).
Btw steve != "steve". Think about that for a bit. You'll probably understand why you're getting the error.