expected a declaration error is at the bracket before the while loop at the bottom PLEASE HELP

#include <iostream>
#include <time.h>
#include <conio.h>
#include <windows.h>
using namespace std;
//prototypes
void seed_random(); // Seeds random number generator
bool coin_toss(void); //
void play_end(bool& first_team, int &t1score, int &t2score);


// Main Program
int main(void)
{
int team1end1; //team ones score for first end
int team2end1; //team two score for first end
int team1end2; //team ones score for second end
int team2end2; //team two score for second end
int team1end3; //team ones score for third end
int team2end3; //team two score for third end
int team1end4; //team ones score for fourth end
int team2end4; //team two score for fourth end
int team1end5; //team ones score for fifth end
int team2end5; //team two score for fifth end
int team1end6; //team ones score for sixth end
int team2end6; //team two score for sixth
int team1end7; //team ones score for seventh end
int team2end7; //team two score for seventh end
int team1end8; //team ones score for eighth end
int team2end8; //team two score for eighth end
int team1end9; //team ones score for ninth end
int team2end9; //team two score for ninth end
int team1end10; //team ones score for tenth end
int team2end10; //team two score for tenth end
int t1score;
int t2score;


//Seed random number generator
//Initilize the variables
team1end1 = 0; //team ones score for first end
team2end1 = 0; //team two score for first end
team1end2 = 0; //team ones score for second end
team2end2 = 0; //team two score for second end
team1end3 = 0; //team ones score for third end
team2end3 = 0; //team two score for third end
team1end4 = 0; //team ones score for fourth end
team2end4 = 0; //team two score for fourth end
team1end5 = 0; //team ones score for fifth end
team2end5 = 0; //team two score for fifth end
team1end6 = 0; //team ones score for sixth end
team2end6 = 0; //team two score for sixth
team1end7 = 0; //team ones score for seventh end
team2end7 = 0; //team two score for seventh end
team1end8 = 0; //team ones score for eighth end
team2end8 = 0; //team two score for eighth end
team1end9 = 0; //team ones score for ninth end
team2end9 = 0; //team two score for ninth end
team1end10 = 0; //team ones score for tenth end
team2end10 = 0; //team two score for tenth end
t1score = 0;
t2score = 0;






cout << "END TEAM CANADA TEAM AUSTRALIA" << endl;
cout << " 1 " << team1end1 << " " << team2end1 << endl;
cout << " 2 " << team1end2 << " " << team2end2 << endl;
cout << " 3 " << team1end3 << " " << team2end3 << endl;
cout << " 4 " << team1end4 << " " << team2end4 << endl;
cout << " 5 " << team1end5 << " " << team2end5 << endl;
cout << " 6 " << team1end6 << " " << team2end6 << endl;
cout << " 7 " << team1end7 << " " << team2end7 << endl;
cout << " 8 " << team1end8 << " " << team2end8 << endl;
cout << " 9 " << team1end9 << " " << team2end9 << endl;
cout << " 10 " << team1end10 << " " << team2end10 << endl;
cout << "--------------------------------------------------" << endl;
cout << "FINAL SCORE " << t1score << " " << t2score << endl;
}//Main

// seed_random - This function seeds the random number generator using the timer
void seed_random()
{
int i; // Loop counter
// Seed the random number generator use the timer
srand((unsigned)time(NULL));
for (i = 0; i < rand(); i++)
rand();
} // seed_random
//Coin flip to determine who gets the hammer
int coin()
{
int flip;
flip = rand() % 2 + 1;// assign random numbers
if (flip == 1)
cout << " " << endl;
else (flip == 2);
cout << " " << endl;
//end if
return (flip);
}
{
while (flip = 1)
{
switch (team1end1)
{
case 1:'0'; // zero points
break;
case 2:'1'; //one point
break;
case 3:'2'; //two points
break;
case 4:'3'; //three points
break;
case 5:'4'; //four points
break;
}
}
}
Last edited on
your code indented
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
#include <iostream>
#include <time.h>
#include <conio.h>
#include <windows.h>
using namespace std;
// prototypes
void seed_random (); // Seeds random number generator
bool coin_toss (void); //
void play_end (bool& first_team, int& t1score, int& t2score);


// Main Program
int main (void)
{
	int team1end1; // team ones score for first end
	int team2end1; // team two score for first end
	int team1end2; // team ones score for second end
	int team2end2; // team two score for second end
	int team1end3; // team ones score for third end
	int team2end3; // team two score for third end
	int team1end4; // team ones score for fourth end
	int team2end4; // team two score for fourth end
	int team1end5; // team ones score for fifth end
	int team2end5; // team two score for fifth end
	int team1end6; // team ones score for sixth end
	int team2end6; // team two score for sixth
	int team1end7; // team ones score for seventh end
	int team2end7; // team two score for seventh end
	int team1end8; // team ones score for eighth end
	int team2end8; // team two score for eighth end
	int team1end9; // team ones score for ninth end
	int team2end9; // team two score for ninth end
	int team1end10; // team ones score for tenth end
	int team2end10; // team two score for tenth end
	int t1score;
	int t2score;


	// Seed random number generator
	// Initilize the variables
	team1end1 = 0; // team ones score for first end
	team2end1 = 0; // team two score for first end
	team1end2 = 0; // team ones score for second end
	team2end2 = 0; // team two score for second end
	team1end3 = 0; // team ones score for third end
	team2end3 = 0; // team two score for third end
	team1end4 = 0; // team ones score for fourth end
	team2end4 = 0; // team two score for fourth end
	team1end5 = 0; // team ones score for fifth end
	team2end5 = 0; // team two score for fifth end
	team1end6 = 0; // team ones score for sixth end
	team2end6 = 0; // team two score for sixth
	team1end7 = 0; // team ones score for seventh end
	team2end7 = 0; // team two score for seventh end
	team1end8 = 0; // team ones score for eighth end
	team2end8 = 0; // team two score for eighth end
	team1end9 = 0; // team ones score for ninth end
	team2end9 = 0; // team two score for ninth end
	team1end10 = 0; // team ones score for tenth end
	team2end10 = 0; // team two score for tenth end
	t1score = 0;
	t2score = 0;


	cout << "END TEAM CANADA TEAM AUSTRALIA" << endl;
	cout << " 1 " << team1end1 << " " << team2end1 << endl;
	cout << " 2 " << team1end2 << " " << team2end2 << endl;
	cout << " 3 " << team1end3 << " " << team2end3 << endl;
	cout << " 4 " << team1end4 << " " << team2end4 << endl;
	cout << " 5 " << team1end5 << " " << team2end5 << endl;
	cout << " 6 " << team1end6 << " " << team2end6 << endl;
	cout << " 7 " << team1end7 << " " << team2end7 << endl;
	cout << " 8 " << team1end8 << " " << team2end8 << endl;
	cout << " 9 " << team1end9 << " " << team2end9 << endl;
	cout << " 10 " << team1end10 << " " << team2end10 << endl;
	cout << "--------------------------------------------------" << endl;
	cout << "FINAL SCORE " << t1score << " " << t2score << endl;
} // Main

// seed_random - This function seeds the random number generator using the timer
void seed_random ()
{
	int i; // Loop counter
	// Seed the random number generator use the timer
	srand ((unsigned)time (NULL));
	for (i = 0; i < rand (); i++)
		rand ();
} // seed_random
// Coin flip to determine who gets the hammer
int coin ()
{
	int flip;
	flip = rand () % 2 + 1; // assign random numbers
	if (flip == 1)
		cout << " " << endl;
	else
		(flip == 2);
	cout << " " << endl;
	// end if
	return (flip);
}
{ //¿what's this supposed to be? you are outside any function
	while (flip = 1)
	{
		switch (team1end1)
		{
		case 1:
			'0'; // zero points
			break;
		case 2:
			'1'; // one point
			break;
		case 3:
			'2'; // two points
			break;
		case 4:
			'3'; // three points
			break;
		case 5:
			'4'; // four points
			break;
		}
	}
}
the loop makes no sense, ¿what are you trying to do there?
Topic archived. No new replies allowed.