do while loop fail

Any Idea why this won't compile? Error message says 72:1: error: expected unqualified-id before 'do'
I don't know what is wrong in my do while loop

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
#include <iostream>
#include <iomanip>
using namespace std;

//*****************************************************************
int lawnMow = 50;					//job cost variable values
int bushTrim = 70;
int pressureWash = 65;
int gutterClean = 45;
int mulch = 100;
//*******************************************************************

//*********************************************************************
//*********************************************************************


//********************************************************************

void menu();                       //menu function prototype
int  getJobs();
	
//********************************************************************

int main()
{


	menu();                        //call menu function
	getJobs();
	
}                                   // end of body
								
//******************************************************************************************************************************************


void menu()
{

	

	cout << "1. Lawn Mow" << setw(5) << "$" << lawnMow << endl;						// show job prices function
	cout << "2. Bushes Trimmed" << setw(5) << "$" << bushTrim << endl;
	cout << "3. Pressure washing" << setw(5) << "$" << pressureWash << endl;
	cout << "4. Gutter Cleaning" << setw(5) << "$" << gutterClean << endl;
	cout << "5. Mulch " << setw(5) << "$" << mulch << endl;
}
//******************************************************************************************************************************************

//*****************************************************************************************************************************************
int choice = 0;

int jobs[5] = { 50, 70, 65, 45, 100 };		// price array 

int lawnMowProfit = jobs[0] += choice;
int bushTrimProfit = jobs[1] += choice;
int pressureWashProfit = jobs[2] += choice;						//itemized profit values
int gutterCleanProfit = jobs[3] += choice;
int mulchProfit = jobs[4] += choice;
//*****************************************************************************************************************************************************

//*******************************************************************************************************************************************************


 void getjobs();

do 
{  
    
    
  cout << "Select the choice of job you have done, then how many times you have done the type of job." << endl << " To finish type done" << endl;
cin >> choice;


 

if (choice == 1)
{
	cout << " how many lawn mowing jobs have you completed " << endl;
	cin >> jobs[0];									//input lawn mowing profits
	cout << lawnmowProfit;						//output lawn mowing profits
}

else if (choice == 2)																				//get number jobs done function
{
	cout << " How many bush trimming jobs have you had" << endl;
	cin >> jobs[1];
	cout << bushTrimProfit;

}

else if (choice == 3)
cout << " How many pressure washing jobs have   you had"
cin >>jobs[2];
cout << pressureWashProfit;

else if (choice == 4)
cout << " How many gutter cleaning jobs have you done?" << endl;
cin >> jobs[3];
cout << gutterCleanProfit;

else if (choice == 5)
cout << " How many mulch jobs have you done" << endl;
cin >> jobs[4];
cout << mulchProfit;

} while (choice != done);
//*****************************************************************************************************************************************************







You have several problems. Go through and verify that all your code is within a function, it's not you have a large part in the middle not in a function. Check that you don't have 2 different functions with the same name, you declare getjobs(); as both an int and a void function. Check that you have semicolons, brackets and other syntax correct. Also, do not use global variables unless they are constant. You need to pass them to the functions that use them. Your big lines of stars do help to break up your code, it would be nice to see more explanation in your comments, it's currently very choppy.
Topic archived. No new replies allowed.