constructor

not compiling. does anyone see an error? it tells me i need a semicolon but i added one

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

class logbook
{
	public:
	
	logbook ()
	{
	
	int salary=0;
	int ID=0;
	cout <<"constructor\n";
	}
~logbook()
{

cout << "deconstructor\n";
system ("pause");

}

void total ()
{
	cout<< "Account contains " << salary<<endl;
	cout << " User's number"<< ID <<endl;
	
 }
 
 double setsalary (double usalary)
 {
 	salary=usalary;
 }
 double getsalary()
 {
 	return salary;

 }
 double setID (double userID)
 {
 	ID = userID;
 	
 }
 double getID ()
 {
 	return ID;
 	
 }
 
 private:
 
 	double ID;
 	double salary;
 	
}

 int main ()
 {
 	logbook log;
 	logbook *lg;
 	lg =&log;
 		double usalary;
 			cout << "enter the employee's salary\n";
			 cin>> usalary;
			 lg->setsalary (usalary);
			 
			 double userID;
			 cout << "enter the ID of the employee\n";
			 cin >> userID;
			 lg->setID (userID);
			 
			 system ("pause");
			 return 0;
		
 }
55:1: error: expected ';' after class definition
In constructor 'logbook::logbook()':
11:6: warning: unused variable 'salary' [-Wunused-variable]
12:6: warning: unused variable 'ID' [-Wunused-variable]
In member function 'double logbook::setsalary(double)':
33:2: warning: no return statement in function returning non-void [-Wreturn-type]
In member function 'double logbook::setID(double)':
43:2: warning: no return statement in function returning non-void [-Wreturn-type]
line 55 does have semicolon. the rest of the errors i am confused on....wouldnt that be considers extra qualification ?
Look at your setID function:

1
2
3
4
 double setID (double userID)
 {
 	ID = userID;
 }


What does the definition promise to return?

What value are you actually returning?
Mediumgrit wrote:
line 55 does have semicolon.
Nope, not in what you have posted.
THANK YOU EVERYONE!
Topic archived. No new replies allowed.