So I recently wrote an interactive question program. It basically starts by asking your age and then it will ask you about your birth information. This in end will help the computer learn if you lied or not and the computer will call you out on it if you did. I have a question though. Is there a better way of creating spaces between the questions instead of me having to create a cout and making a string just to use \n? Because it takes up space and kinda makes the code messy. Thanks.
#include <iostream>
usingnamespace std;
int main()
{
//A bunch of variables holding things and such.
int age;
int realAge;
int birthD;
int birthY;
string birthM;
string f = "February";
cout << "How old are you? \n";
cin >> age;
cout << "\n";
cout << "Okay, so you are " << age << "\n" << endl;
cout << "Alright then, so what month is your birthday in?" << endl;
cin >> birthM;
cout << "\n";
//Determines whether or not if the user and computer have the same birthday or not.
if (birthM == f){
cout << "My birthday is in " << f << " to!" << endl; //If user inputs February as his/her's birthday then the computer will notify the user they have the same birthdays.
}
else{
cout << "Ok, so your birthday is in " << birthM << "." << endl; //If not, then the computer will ask the next question.
}
cout << "What day were you born in " << birthM << "?" << endl;
cin >> birthD;
cout << "\n";
cout << "Okay, got it. Now what year were you born in?" << endl;
cin >> birthY;
cout << "\n";
realAge = 2015 - birthY;
//Computer calculates if you were telling a lie or not.
if (realAge == age) {
cout << "So you were telling the truth!"; //Computer figures out you told the truth.
}
else
cout << "You lying dog! You're not " << age << " You're " << realAge << "!"; //The computer calculates that you lied, ya lier.
return 0;
}