rat race

ok, now here is my code.. can anyone help me how to work this properly???
that whan i press a key the > symbol will move to the left... and other > symbol also..

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
#include <stdio.h>
#include <conio.h>

main()
{
int q,w,x,y;

//character select
printf("\n\n\n\n\n\n\n\n\n\n                  ***************************************");
printf("\n                  * choose youre mouse number from 1-15 *");
printf("\n                  ***************************************");
scanf("%d", &q);
switch(q)
	{
		case 1:printf(" \n                       *you selected mouse number 1*");break;
		case 2:printf(" \n                       *you selected mouse number 2*");break;
		case 3:printf(" \n                       *you selected mouse number 3*");break;
		case 4:printf(" \n                       *you selected mouse number 4*");break;
		case 5:printf(" \n                       *you selected mouse number 5*");break;
		case 6:printf(" \n                       *you selected mouse number 6*");break;
		if(q!=1&&q!=2&&q!=3&&q!=4&&q!=5&&q!=6)
		{
		default:gotoxy(32,15);printf("invalid input");break;
		}
	}

//start
printf("\n\n             *press your mouse number to Start and press Enter!*");
scanf("%d", &q);
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");

x=0;
y=2;
//main
//rat1
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
		scanf("%d", &q);
	}
//rat 2
x=0;
y=2;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 3
x=0;
y=3;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 4
x=0;
y=4;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 5
x=0;
y=5;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 6
x=0;
y=6;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 7
x=0;
y=7;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 8
x=0;
y=8;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 9
x=0;
y=9;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 10
x=0;
y=10;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 11
x=0;
y=11;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 12
x=0;
y=12;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 13
x=0;
y=13;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 14
x=0;
y=14;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}
//rat 15
x=0;
y=15;
while (x<70)
	{
		x=x+1;
		gotoxy(x,y);
		printf(">");
	}

getch();
return 0;
}
Your code contains a lot of errors especially with the gotoxy, you need to use goto xy, but since there is no xy so it will not work.
Check this out

http://www.cplusplus.com/doc/tutorial/control/
Last edited on
mausy131 wrote:
Your code contains a lot of errors especially with the gotoxy, you need to use goto xy, but since there is no xy so it will not work.

The gotoxy in question here isn't a goto statement with an xy label. It's actually a C function from the conio.h header.
Okay I actually thought it was a goto with xy as label.
Thanks for improving!
Topic archived. No new replies allowed.