Creating Spaces

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  #include <iostream>
using namespace 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;
}
Last edited on
Just use system("clear") function which will neatly clear your screen every time your question is answered...
Thanks a lot.
Topic archived. No new replies allowed.