Psychic Program

What are my issues here?
I've double checked an am not sure what to do. Here's the link to the directions.
(Exercise 4)
http://www.cs.csi.cuny.edu/~zelikovi/csc126/CSC126-Lab4.pdf

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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include<iostream>
void love();
void finance();
void school();
void decision();
//M. Jacobsen
//November 12th
//Lab 4 Exercise 4
using namespace std;
int main()
{
    int favnum, retry;
    cout << "Welcome! I am your personal psychic. I am capable of telling what the future holds for you." << endl;
    cout << "Let's start with your lucky number... What might that be? ";
    cin >> favnum;
    cout << endl << endl;
    srand(favnum);
    
    decision();
    
    cout << "Thank you for trusting my powers." << endl;
    cout << "Care to know more? (y/n)";
    cin >> retry;
    
    if (retry == 'Y' || retry == 'y')
        decision();

    if (retry == 'N' || retry == 'n')
        return 0;

}

void decision (void)
{
    char decision;
    cout << "Please type the first letter of the topic in which you would like predicted. Your options include: (L)ove, (F)inance, and (S)chool.";
    cin >> decision;
    cout << endl << endl;
    cout << "Ahh.. I like that choice! Let me gaze into my Crystal Ball.." << endl;
    if (decision == 'L' || decision == 'l')
        love();
    else if (decision == 'F' || decision == 'f')
        finance();
    else if (decision == 'S' || decision == 's')
        school();
        
}

void love(void)
{
    int x = rand()%5+1;
    switch(x)
    {
        case 1:
            cout << "Neverending happiness will quickly approach." << endl;
            break;
        case 2:
            cout << "Don't search for love, let it find you." << endl;
            break;
        case 3:
            cout << "Close friends may try to interfere with your love life. Overcome that obstacle to receive the key to happiness." << endl;
            break;
        case 4:
            cout << "You will ask your crush out confidently.. and your confidence shall be rewarded." << endl;
            break;
        case 5:
            cout << "You're going to live happily alone with the comfort of your pets." << endl;
            break;
    }
}

void finance(void)
{
    int x = rand() % 5 + 1;
    switch(x)
    {
        case 1:
            cout << "Cha ching! You're gonna hit the lottery!" << endl;
            break;
        case 2:
            cout << "You're going to live comfortably." << endl;
            break;
        case 3:
            cout << "You have the potential to be a millionaire!" << endl;
            break;
        case 4:
            cout << "Your lack of ingenuity will cause you to go broke." << endl;
            break;
        case 5:
            cout << "Unfortunately, you are going to be unemployed for a while, but don't worry, your parents will take care of you." << endl;
            break;
    }
}

void school(void)
{
    int x = rand() % 5 + 1;
    switch(x)
    {
        case 1:
            cout << "Your future holds an abundance of A's. Keep working hard." << endl;
            break;
        case 2:
            cout << "Slacking off is going to ruin your GPA." << endl;
            break;
        case 3:
            cout << "Hard work and dedication is what makes you unique. Your teachers are going to notice, as well as your future employers." << endl;
            break;
        case 4:
            cout << "Just because you can get 80's without studying doesn't mean you shouldn't study. Always reach for the stars!" << endl;
            break;
        case 5:
            cout << "Sure, C's get degrees, but they don't get high paying jobs.. Focus!" << endl;
            break;
    }
}
I like that you seeded srand() with the user's number choice.

You need to add something to handle incorrect user inputs, and implement near the end of main() so that they can try again. The 'retry' variable should not be declared as an int, but char.
Topic archived. No new replies allowed.