Code:
#include <iostream>
using namespace std;
int main()
{
char personality[20];
cout <<"Enter personality: " <<endl;
cin.getline(personality,20);
if (personality[20] == 'mad')
{
cout <<"$$$$ the world!" <<endl;
}
else
{
cout <<"Lovely" <<endl;
}
system("pause");
}
should be:
Code:
#include <iostream>
using namespace std;
//#include <string> //for alternate if statement below
int main()
{
char personality[20];
cout <<"Enter personality: " <<endl;
cin.getline(personality,20,'\n');
if (personality == "mad") //or if(!strcmpi(personality,"mad");
cout <<"$$$$ the world!" <<endl;
else
cout <<"Lovely" <<endl;
system("pause");
return 0;
}