It's a simple program. You first type your favorite movie, then your favorite game,
if your favorite game and movie matches with the programmer's favorites,
you then see a message "Wow! It seems we have so many things in common.".
It works fine, but I'd like to know if i coded this correctly, or if there's anything
that should be done to make the code cleaner.
Code:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char fvrtMovie[100];
char fvrtGame[100];
int points = 0;
cout<<"Type your favorite movie: ";
cin.getline(fvrtMovie,100);
cout<<"\n\n";
if(strcmp(fvrtMovie,"Godfather") == 0 || strcmp(fvrtMovie,"The Godfather") == 0)
{
cout<<"Really? That's my favorite movie, too!";
points++;
}
else
{
cout<<"Hmmm, I see..." ;
}
cin.get();
cout<<"\n\nNow, what's your favorite game? ";
cin.getline(fvrtGame,100);
if(strcmp(fvrtGame,"Street Fighter") == 0)
{
cout<<"\n\nThat's your favorite game, too?";
points++;
}
else
{
cout<<"\n\nOh, "<<fvrtGame<<". I see...";
}
if(points >= 2)
{
cin.get();
cout<<"Wow! It seems we have so many things in common.";
}
cin.get();
return 0;
}