guessing game with points.

hi guys, need help. im having a problem on how to add or subtract the points from point of risk.
example output.
how many points would you like?200
guesses choice..
(switch case)
how many guesses would you like?2
enter choice:o
enter number:3
point at risk? 10
winning number is:
you lost/gain points:
here's my code so far:
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#include<stdio.h>
#include<conio.h>
#include <time.h>
#include <stdlib.h>

main() 
{
srand(time(NULL));

int guess,r,guesses;
int points=0,n;

printf("How many points would you like? ");
scanf("%d",&points);

char choice;
int array[5],i;


printf("\nGuesses Choices \n");
printf("O-Odd \t\t[01-35]\nE-Even\t\t[02-36] \nL-Low \t\t[01-12] \nM-Medium \t[13-24] \nH-High \t\t[25-36] \nN-Number\t[01-36]\n");

printf("\nGuess Limit is 5");
printf("\nHow many guesses would you like? ");
scanf(" %d",&guesses);

for(i=0;i<guesses;i++){
printf("\nGuess %d",i+1);

printf("\nEnter your choice: ");
scanf(" %c", &choice);

switch (choice) {

case 'O':
case 'o':    
     odd();break;

case 'E':
case 'e':
    even();break;

case 'L':
case 'l':
    low();break;

case 'M':
case 'm':
     medium();break;

case 'H':
case 'h':
     high();break;
     
case 'F':
case 'f':
     
printf("Left\n");
break;

case 'C':
case 'c':
printf("Center\n");
break;

case 'R':
case 'r':
printf("Right\n");
break;

case 'N':
case 'n':
   number();break;
default:
printf("Try again!\n");

scanf(" %d",array[i]);
}

}



getch();
}



int odd(int guess,int r,int points, int n)
{
    int b =1+(2*rand ()) %36,an,b1,b2;
    
     printf("enter number: ");
     scanf("%d",&guess);
     printf("Point at risk? ");
     scanf("%d",&r);



     if(guess<b || guess>b){
                an=b;
     printf("Winning number is : %d",an);
                b1=r;
                printf("\nYou lost %d point(s).\n",b1); 
                }  
             
                if(guess==b)
                {
                an=b;
     printf("Winning number is : %d",an);
                b2=r+r;          
                printf("\nYou gain %d point(s)\n",b2);}
                 
}

int even(int guess,int r)
{
    int c =2+(2*rand ()) %36,an2,c1,c2;
    
     printf("enter number: ");
     scanf("%d",&guess);
     printf("Point at risk? ");
     scanf("%d",&r);
     if(guess<c || guess>c){
                an2=c;
     printf("Winning number is : %d",an2);
                c1=r;
                printf("\nYou lost %d point(s).\n",c1);
                }              
                if(guess==c)
                {
                c2=r+r;                
                printf("You gain %d point(s)",c2);}
}

int low(int guess,int r)
{
    int l=rand() % 12+1,l2,l3,ans1;
    
     printf("enter number: ");
     scanf("%d",&guess);
     printf("Point at risk? ");
     scanf("%d",&r);

     if(guess<l || guess>l){
                ans1=l;
     printf("Winning number is : %d",ans1);
                l2=r;
                printf("\nYou lost %d point(s).\n",l2);
                }

                
                if(guess==l)
                {
                l3=r+r;                
                printf("You gain %d point(s) \n",l3);}
}

int medium(int guess,int r)
{
    int m=rand() % 12+13,m2,m3,ans2;
    
     printf("enter number: ");
     scanf("%d",&guess);
     printf("Point at risk? ");
     scanf("%d",&r);


     if(guess<m || guess>m){
                ans2=m;
     printf("Winning number is : %d",ans2);
                m2=r;
                printf("\nYou lost %d point(s).\n",m2);
                }

                
                if(guess==m)
                {
                m3=r+r;                
                printf("You gain %d point(s)\n",m3);}
}

int high(int guess,int r)
{
    int h=rand() % 12+25,h2,h3,ans3;
    
     printf("enter number: ");
     scanf("%d",&guess);
     
     printf("Point at risk? ");
     scanf("%d",&r);

     if(guess<h || guess>h){           
                 ans3=h;
     printf("Winning number is : %d",ans3);
                h2=r;
                printf("\nYou lost %d point(s).\n",h2);
                }

                
                if(guess==h)
                {
                h3=r+r;                
                printf("You gain %d point(s) \n",h3);}
}

int number(int guess,int r)
{
   int number = rand() % 36,ans,p,t;
   
     printf("enter number: ");
     scanf("%d",&guess);
     printf("Point at risk? ");
     scanf("%d",&r);

     if(guess<number || guess>number){
     ans=number;
     printf("Winning number is : %d",ans);
     
                p=r;
                printf("\nYou lost %d point(s).\n",p);
                }               
                if(guess==number)
                {
                 t=r+r;                
                 printf("You gain %d point(s) \n",t);}
}



Topic archived. No new replies allowed.