I am having some unusual compiler warning messages and my input is being skipped over...

This program computes a patient's bill for a hospital stay...It is about complete except that I am getting a different compiler message.. it says that:

-first argument of 'int main(float, float, float)' should be 'int' [-Wmain],
-second argument of 'int main(float, float, float)' should be 'char **' [-Wmain],
-third argument of 'int main(float, float, float)' should probably be 'char **' [-Wmain]

Despite this it still runs however when it gets to the surgery type/cost input it skips over the input for the name of the surgery, and asks for input to surgery cost. Why is this and what do the compile warning messages me, because they obviously should be float... right?


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
//*************************************************************************************************************************************************************************
// Patient.cpp - this program computes a patient's bill for a hospital stay. The different components are as follows:													   
//		The PatientAccount class: keeps a total of the patient's charges. Also keeps track of the number of days spent in the hospital.   								   
//		The Surgery class: stores the charges for at least five types of surgery. 		*It can update the charges variable of the PatientAccount class.*				   
//		The Pharmacy class: stores the price of at least five types of medication . 	*It can update the charges variable of the PatientAccount class.*				   
// Last modified by Coy Sills on April 25th, 2014.					       									     														   
//*************************************************************************************************************************************************************************

#include <iostream>
#include <string>
using namespace std;

class PatientAccount
{
	private:
		float dailyRate;
		int patientNumber;
		int days;
		string patientName;

	public:
		PatientAccount(float, int, int, string);
		float getDailyRate();
		int getPatientNumber();
		int getDays();
		string getPatientName();
		void getPatientDisplay(float& totalCost);
};

PatientAccount::PatientAccount(float dr = 0, int pnum = 0, int dy = 0, string pn = " ")
{
	dailyRate = dr;
	patientNumber = pnum;
	days = dy;
	patientName = pn;
}

float PatientAccount::getDailyRate()
{
	cout << "Enter the daily rate for each day in the hospital: $";
	cin >> dailyRate;
	return dailyRate;
}

int PatientAccount::getPatientNumber()
{
	cout << "Enter the patients number: ";
	cin >> patientNumber;
	return patientNumber;
}

int PatientAccount::getDays()
{
	cout << "Enter the amount of days spent in the hospital: ";
	cin >> days;
	return days;
}

string PatientAccount::getPatientName()
{
	cout << "Enter the patients name: ";
	getline(cin, patientName);
	return patientName;
}

class Surgery
{
	private:
		float surgeryCost;
		string surgeryType;
		
	public:
		Surgery(float, string);
		float getCost();
		string getSurgeryType();
		void getSurgeryDisplay(float& totalCost1);
};

Surgery::Surgery(float co = 0, string st = " ")
{
	surgeryCost = co;
	surgeryType = st;
}

float Surgery::getCost()
{
	cout << "Enter the total cost of surgery: $";
	cin >> surgeryCost;
	return surgeryCost;
}

string Surgery::getSurgeryType()
{
	cout << "Enter the name of the surgery type: ";
	getline(cin, surgeryType);
	return surgeryType;
}

class Pharmacy
{
	private:
		float medCost;
		string medName;

	public:
		Pharmacy(float, string);
		float getMedCost();
		string getMedName();
		void getPharmacyDisplay(float& totalCost2);
};

Pharmacy::Pharmacy(float mc = 0, string mn = " ")
{
	medCost = mc;
	medName = mn;
};

float Pharmacy::getMedCost()
{
	cout << "Enter the cost of the medication: $";
	cin >> medCost;
	return medCost;
}

string Pharmacy::getMedName()
{
	cout << "Enter the medication name: ";
	getline(cin, medName);
	return medName;
}

void PatientAccount::getPatientDisplay(float& totalCost)
{
	PatientAccount patient(getDailyRate(), getPatientNumber(), getDays(), getPatientName());
	totalCost = days * dailyRate;

	cout << "\n";
	cout << "Patient Name:              " << patientName << endl;
	cout << "Patient Number:            " << patientNumber << endl;
	cout << "Days:                      " << days << endl;
	cout << "Daily Rate:               $" << dailyRate << endl;
	cout << "Total Cost:               $" << totalCost << endl;
	cout << "\n";
}

void Surgery::getSurgeryDisplay(float& totalCost1)
{
	Surgery patient(getCost(), getSurgeryType());
	totalCost1 = surgeryCost;
	cout << "Surgery Type:              " << surgeryType << endl;
	cout << "Surgery Cost:             $" << surgeryCost << endl;
	cout << "Total Cost:               $" << totalCost1 << endl;
	cout << "\n";
}

void Pharmacy::getPharmacyDisplay(float& totalCost2)
{
	Pharmacy patient(getMedCost(), getMedName());
	totalCost2 = medCost;
	cout << "Medication Name:           " << medName << endl;
	cout << "Medication Cost:          $" << medCost << endl;
	cout << "Total Cost:               $" << totalCost2 << endl;
	cout << "\n";
}

int main(float totalCost, float totalCost1, float totalCost2)
{
	float totalCost3;

	PatientAccount patient;
	Surgery patient1;
	Pharmacy patient2;

	patient.getPatientDisplay(totalCost);
	patient1.getSurgeryDisplay(totalCost1);
	patient2.getPharmacyDisplay(totalCost2);

	totalCost3 = ((totalCost + totalCost2) + totalCost2);
	cout << "Total Cost Hospital:     $" << totalCost3 << endl;
	cout << "\n";
	cout << endl << "Press ENTER to exit...";
	cin.clear();
	cin.sync();
	cin.get();

	return 0;
}
Standard defines what the main() can take as parameters. Three floats is not an option.
Is this why input is skipped over? How would I fix this?
Well, I updated the main() parameters and declared the variables inside main instead. The program still skips over input. Why is this?

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
//*************************************************************************************************************************************************************************
// Patient.cpp - this program computes a patient's bill for a hospital stay. The different components are as follows:													   
//		The PatientAccount class: keeps a total of the patient's charges. Also keeps track of the number of days spent in the hospital.   								   
//		The Surgery class: stores the charges for at least five types of surgery. 		*It can update the charges variable of the PatientAccount class.*				   
//		The Pharmacy class: stores the price of at least five types of medication . 	*It can update the charges variable of the PatientAccount class.*				   
// Last modified by Coy Sills on April 25th, 2014.					       									     														   
//*************************************************************************************************************************************************************************

#include <iostream>
#include <string>
using namespace std;

class PatientAccount
{
	private:
		float dailyRate;
		int patientNumber;
		int days;
		string patientName;

	public:
		PatientAccount(float, int, int, string);
		float getDailyRate();
		int getPatientNumber();
		int getDays();
		string getPatientName();
		void getPatientDisplay(float& totalCost);
};

PatientAccount::PatientAccount(float dr = 0, int pnum = 0, int dy = 0, string pn = " ")
{
	dailyRate = dr;
	patientNumber = pnum;
	days = dy;
	patientName = pn;
}

float PatientAccount::getDailyRate()
{
	cout << "Enter the daily rate for each day in the hospital: $";
	cin >> dailyRate;
	return dailyRate;
}

int PatientAccount::getPatientNumber()
{
	cout << "Enter the patients number: ";
	cin >> patientNumber;
	return patientNumber;
}

int PatientAccount::getDays()
{
	cout << "Enter the amount of days spent in the hospital: ";
	cin >> days;
	return days;
}

string PatientAccount::getPatientName()
{
	cout << "Enter the patients name: ";
	getline(cin, patientName);
	return patientName;
}

class Surgery
{
	private:
		float surgeryCost;
		string surgeryType;
		
	public:
		Surgery(float, string);
		float getCost();
		string getSurgeryType();
		void getSurgeryDisplay(float& totalCost1);
};

Surgery::Surgery(float co = 0, string st = " ")
{
	surgeryCost = co;
	surgeryType = st;
}

float Surgery::getCost()
{
	cout << "Enter the total cost of surgery: $";
	cin >> surgeryCost;
	return surgeryCost;
}

string Surgery::getSurgeryType()
{
	cout << "Enter the name of the surgery type: ";
	getline(cin, surgeryType);
	return surgeryType;
}

class Pharmacy
{
	private:
		float medCost;
		string medName;

	public:
		Pharmacy(float, string);
		float getMedCost();
		string getMedName();
		void getPharmacyDisplay(float& totalCost2);
};

Pharmacy::Pharmacy(float mc = 0, string mn = " ")
{
	medCost = mc;
	medName = mn;
};

float Pharmacy::getMedCost()
{
	cout << "Enter the cost of the medication: $";
	cin >> medCost;
	return medCost;
}

string Pharmacy::getMedName()
{
	cout << "Enter the medication name: ";
	getline(cin, medName);
	return medName;
}

void PatientAccount::getPatientDisplay(float& totalCost)
{
	PatientAccount patient(getDailyRate(), getPatientNumber(), getDays(), getPatientName());
	totalCost = days * dailyRate;

	cout << "\n";
	cout << "Patient Name:              " << patientName << endl;
	cout << "Patient Number:            " << patientNumber << endl;
	cout << "Days:                      " << days << endl;
	cout << "Daily Rate:               $" << dailyRate << endl;
	cout << "Total Cost:               $" << totalCost << endl;
	cout << "\n";
}

void Surgery::getSurgeryDisplay(float& totalCost1)
{
	Surgery patient(getCost(), getSurgeryType());
	totalCost1 = surgeryCost;
	cout << "Surgery Type:              " << surgeryType << endl;
	cout << "Surgery Cost:             $" << surgeryCost << endl;
	cout << "Total Cost:               $" << totalCost1 << endl;
	cout << "\n";
}

void Pharmacy::getPharmacyDisplay(float& totalCost2)
{
	Pharmacy patient(getMedCost(), getMedName());
	totalCost2 = medCost;
	cout << "Medication Name:           " << medName << endl;
	cout << "Medication Cost:          $" << medCost << endl;
	cout << "Total Cost:               $" << totalCost2 << endl;
	cout << "\n";
}

int main()
{
	
	float totalCost, totalCost1, totalCost2, totalCost3;

	PatientAccount patient;
	Surgery patient1;
	Pharmacy patient2;

	patient.getPatientDisplay(totalCost);
	patient1.getSurgeryDisplay(totalCost1);
	patient2.getPharmacyDisplay(totalCost2);

	totalCost3 = ((totalCost + totalCost2) + totalCost2);
	cout << "Total Cost Hospital:     $" << totalCost3 << endl;
	cout << "\n";
	cout << endl << "Press ENTER to exit...";
	cin.clear();
	cin.sync();
	cin.get();

	return 0;
}


Enter the patients name: John
Enter the amount of days spent in the hospital: 2
Enter the patients number: 101
Enter the daily rate for each day in the hospital: $5

Patient Name:              John
Patient Number:            101
Days:                      2
Daily Rate:               $5
Total Cost:               $10

Enter the name of the surgery type: Enter the total cost of surgery: $5
Surgery Type:
Surgery Cost:             $5
Total Cost:               $5

Enter the medication name: Enter the cost of the medication: $5
Medication Name:
Medication Cost:          $5
Total Cost:               $5

Total Cost Hospital:     $20
Hey man don't double post. I just answered your question in your other thread:
http://www.cplusplus.com/forum/beginner/130471/
You're response did not help.
Adding
cin.ignore(std::numeric_limits<std::streamsize>::max()); results in an endless loop of input.
Topic archived. No new replies allowed.