I have an extremely simple code that I did, and that ^ (up there) error.
my code goes like this:
#include <iostream>
using namespace std;
int main()
{
char input[80];
char name[80];
cout << "Hello!\n" << endl;
cin>> input;
if (input == "hello" || "hi"){
cout<< "Hi, whats your name?\n";
cin>> name;
cout>> "Nice to meet you,"<< name <<", my name is Hal.\n";
}
return 0;
}
I would really appreciate some help with this.
thank you.
You used >> when it should be <<.
Also this statement is invalid
if (input == "hello" || "hi"){
Shall be
if ( strcmp( input, "hello" ) == 0 || strcmp( input, "hi" ) == 0 ){
I didn't know that function when I did this, and I just did, actually, so thank you I will do that probably now.
Thanks
Why not just use strings?