when i compile the following code it gives the following error on the line indicated in bold: - #include<iostream>
-
#include<iomanip>
-
#include<cstdlib>
-
-
-
-
using std::cin;
-
using std::cout;
-
using std::endl;
-
using std::left;
-
using std::right;
-
using std::setprecision;
-
using std::setw;
-
using std::fixed;
-
-
void welcome();
-
int getPatientIndicators();
-
int readInteger();
-
void flushStream(void);
-
int getValidInteger ( int min, int max );
-
void getYesNoResponse(char &response);
-
void classifyPatient(int &numCat1, int &numCat2, int &numCat3, int patientPoints);
-
void displayPatientSummmary(int numCat1, int numCat2, int numCat3, int numPatients);
-
void displayStaffingSummar(int numcat1, int numcat2, int numcat3);
-
-
-
int main()
-
{
-
int option = 0;
-
int numCat1= 0;
-
int numCat2= 0;
-
int numCat3= 0;
-
int patientPoints = 0;
-
int numPatients = 0;
-
int numcat1 = 0;
-
int numcat2 = 0;
-
int numcat3 = 0;
-
-
welcome();
-
option = getPatientIndicators();
-
-
do
-
{
-
-
if (option == 1)
-
{
-
classifyPatient(numCat1,numCat2,numCat1,patientPoints);
-
}
-
else if (option == 2)
-
{
-
displayPatientSummmary(numCat1,numCat2,numCat3,numPatients);
-
}
-
else if (option == 3)
-
{
-
displayStaffingSummar(numcat1,numcat2,numcat3);
-
}
-
else
-
{
-
exit(0);
-
}
-
while (option != 0);
-
}
-
-
return 0;
-
}
-
-
-
-
void welcome()
-
{
-
-
-
cout<<endl<<endl;
-
cout<<"Welcome to Base Hospital Nursing Care Program."<<endl<<endl;
-
cout<<"Menu Options:"<<endl;
-
cout<<"1."<<setw(6)<<"Classify a Patient."<<endl;
-
cout<<"2."<<setw(6)<<"Display Patient Data Summary."<<endl;
-
cout<<"3."<<setw(6)<<"Display Staffing Summary."<<endl;
-
cout<<"0."<<setw(0)<<"Exit."<<endl;
-
-
-
}
-
-
int getPatientIndicators()
-
{
-
int option = 0;
-
-
cout<<"Select Option:=> ";
-
option = readInteger();
-
-
return option;
-
}
-
-
int readInteger() // function definition
-
{
-
int tempInt; // a local variable
-
cin >> tempInt;
-
while (cin.fail())
-
{
-
cin.clear(); // clear input error flags
-
flushStream(); // clear to end of line
-
cout << "ERROR: You must enter an integer ==> ";
-
cin >> tempInt; // try again
-
}
-
return tempInt;
-
}
-
-
void flushStream(void)
-
{
-
char temp = ' ';
-
-
cin.get(temp);
-
while (temp != '\n')
-
{
-
cin.get(temp);
-
}
-
}
-
-
int getValidInteger ( int min, int max )
-
{
-
int choice ;
-
-
choice = readInteger();
-
-
// ensure integer within range
-
while ( choice < min || choice > max )
-
{
-
cout << "Error: please enter a number between " << min
-
<< " and " << max << " : " ;
-
choice = readInteger () ;
-
}
-
return choice ;
-
}
-
-
void getYesNoResponse(char &response)
-
{
-
cin>>response;
-
-
while(!((response=='Y')||(response=='N')||(response=='y')||(response=='n')))
-
{
-
cout<<"Please Enter(Y or N):";
-
cin>>response;
-
}
-
}
-
-
void classifyPatient(int &numCat1, int &numCat2, int &numCat3, int patientPoints)
-
{
-
int points = 0;
-
int hours = 0;
-
int points1 = 0;
-
int points2 = 0;
-
int points3 = 0;
-
int points4 = 0;
-
int points5 = 0;
-
int feed = 0;
-
int bath = 0;
-
int assist = 0;
-
char incon = 0;
-
char agg = 0;
-
-
cout<<endl<<endl;
-
cout<<"Classifying Patient No: "<<endl<<endl;
-
cout<<"Enter nutrition care level"<<endl;
-
cout<<"[1. Feed with assist, 2. Complete Feeding]==> ";
-
feed = readInteger();
-
-
if(feed == 1)
-
{
-
points1 = 3;
-
}
-
else
-
{
-
points1 = 5;
-
}
-
cout<<endl<<endl;
-
cout<<"Enter hygiene care level"<<endl;
-
cout<<"[1. Bath, self, 2. Bath assisted]==> ";
-
bath = readInteger();
-
-
if(bath == 1)
-
{
-
points2 = 2;
-
}
-
else
-
{
-
points2 = 5;
-
}
-
cout<<endl<<endl;
-
cout<<"Enter activity care level"<<endl;
-
cout<<"[1. Up without assist, 2. Up with assist, 3. Complete Imobility]==> ";
-
assist = readInteger();
-
if(assist == 1)
-
{
-
points3 = 2;
-
}
-
else if(assist == 2)
-
{
-
points3 = 4;
-
}
-
else
-
{
-
points3 = 10;
-
}
-
cout<<endl<<endl;
-
cout<<"Does the patient suffer from incontinence? (Y/N)==> ";
-
getYesNoResponse(incon);
-
if (incon == 'Y' || incon == 'y')
-
{
-
points4 = 10;
-
}
-
else
-
{
-
points4 = 0;
-
}
-
cout<<endl<<endl;
-
cout<<"Is the patient aggresive (Y/N)==> ";
-
getYesNoResponse(agg);
-
if (agg == 'Y' || incon == 'y')
-
{
-
points5 = 10;
-
}
-
else
-
{
-
points5 = 0;
-
}
-
cout<<endl<<endl<<endl;
-
-
points = points1+points2+points3+points4+points5;
-
-
if (points == 0 || points <=20)
-
{
-
patientPoints = 3;
-
}
-
else if (points == 21 || points <= 30)
-
{
-
patientPoints = 7;
-
}
-
else
-
{
-
patientPoints = 12;
-
}
-
-
cout<<"total care hours"<<patientPoints<<endl;
-
-
}
-
-
void displayPatientSummmary(int numCat1, int numCat2, int numCat3, int numPatients)
-
{
-
// now display the output
-
cout << endl << endl << setw(40) << "Patient Summary Report" << endl<<endl<<endl;
-
cout << setw(15) << left<< "Category" << setw(5) << right << "Care Rates<Hrs>"
-
<< setw(15) << fixed << setprecision(2) << "#Patients" << setw(15) << right
-
<< setprecision(2) << "%Distribn." << endl<<endl;
-
-
cout << setw(15) << left<< "Category 1" << setw(10) << right << "3"
-
<< setw(15) << fixed << setprecision(2) << "0" << setw(15) << right
-
<< setprecision(2) << "0" << endl;
-
-
cout << setw(15) << left<< "Category 2" << setw(10) << right << "7"
-
<< setw(15) << fixed << setprecision(2) << "0" << setw(15) << right
-
<< setprecision(2) << "0" << endl;
-
-
cout << setw(15) << left<< "Category 3" << setw(10) << right << "12"
-
<< setw(15) << fixed << setprecision(2) << "0" << setw(15) << right
-
<< setprecision(2) << "0" << endl << endl;
-
-
-
}
-
-
void displayStaffingSummar(int numcat1, int numcat2, int numcat3)
-
{
-
int points = 0;
-
int nurses = 0;
-
const int num = 8;
-
-
points = getPatientIndicators();
-
-
nurses = points/num;
-
-
cout<<"Thus number of nurses needed: "<<setprecision(2)<<nurses<<endl;
-
}
it gives me a compilation error as: error C2059: syntax error : 'return'
i cant resolve this no matter what i try,any help will be appreciated.tha nx
4 1518 Savage 1,764
Recognized Expert Top Contributor
Please improve ur coding style and use code tags
U can't see what problem is if u don't tab in.
U also have one parenthesis more than u need.
I have 'cleaned' ur code a bit,so try it now and remember to use code tags when posting. -
-
do
-
{
-
-
if (option == 1)
-
{
-
classifyPatient(numCat1,numCat2,numCat1,patientPoi nts);
-
}
-
else if (option == 2)
-
{
-
displayPatientSummmary(numCat1,numCat2,numCat3,num Patients);
-
}
-
else if (option == 3)
-
{
-
displayStaffingSummar(numcat1,numcat2,numcat3);
-
}
-
else exit(0);
-
-
}while (option != 0);
-
return 0;
-
-
}
-
Savage
it gives me a compilation error as:
error C2059: syntax error : 'return'
i cant resolve this no matter what i try,any help will be appreciated.tha nx
Remove the extra '}' after while (option != 0);
Also i get more errors in your program but not sure if its the whole code here. so if u still have anything else, will be glad to try and solve it
hey guys thanx,as u can makeout im a newbie and still learning,my coding style is not good.but thanx for the tips and help.apreciate it.cheers!
Savage 1,764
Recognized Expert Top Contributor
hey guys thanx,as u can makeout im a newbie and still learning,my coding style is not good.but thanx for the tips and help.apreciate it.cheers!
We are mory than happy to help u.
All u need is to make sure that questions u ask don't violate posting guidelines.
BTW,have u readed them?
If u haven't please read them when u have time.
:)
Savage
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Francis Bell |
last post by:
Hello, I've got a 25 line file with lines of data like this:
sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
The first field is the code that determines what to do. I need to loop
through this data file and, based on that first field, execute different
cases in a switch statement (yes, there's only one now...I'm in a
building process, and I need to get the first one to read first.).
However, it's only going through 1 time and it should...
|
by: trint |
last post by:
Ok,
Everything connects correctly and loads properly in this
WebApplication. I have four buttons and all work correctly except one
(the NEXT RECORD button). PREVIOUS, FIRST and LAST all work properly.
This identical code works correctly in a windows app.
Please tell me what I am doing wrong.
Here is my connection code:
private void InitializeDataConnection ()
|
by: Madhu Gopinathan |
last post by:
Hi All,
I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor. Each task is processed in a separate thread. Each of the executer threads is an STA thread, and it goes ahead and executes the task.
No problems are encountered when tasks are executed one at a time, but when multiple tasks are executed...
|
by: feng zhu |
last post by:
Hi All,
I''m using c# in asp.net and I tried to encode some upper part of ASCII chars, eg. á
The desired result should be: %E1
But when I use HttpUtility.UrlEncode("á"), the output result is: %c3%a1
I tried ISO 8859-1 and utf-8, neither works.
anybody can help me?
Or other way to do it, javascript escape?no experice with that
thanks for any help
Feng
|
by: Simon Harvey |
last post by:
Hi,
I'm hoping someone can help me witht he following problem:
I have a fairly simple page that has a sort form and a button for adding the
forms details to an arraylist.
When the button is pressed, the information from the form needs to be added
to a list in the bottom half of the page.
| |
by: TycoonUK |
last post by:
Hi,
I am having trouble with the U. K. - 70th Anniversary link on my
website when under internet explorer where this page crashes i.e.
This has happened since I started to use my new CSS Menu and I
wondered if anyone can help me.
Many thanks in advance
|
by: russell.hunter |
last post by:
I have pear installed on my web server. The problem is, I can't seem
to get it working!
Whenever I try to call one of the installed packages, for example:
require_once "DB.php";
I get the following error:
Warning: main(): open_basedir restriction in effect.
|
by: sharonrao123 |
last post by:
product page has datalist control with paging implemented by gridview control, ProductDetail is the second page with back button which will take the user to the previous page.
The problem is when i go to second page in the datalistcontrol and click back button in productdetail page, even the browser back button dosent work, the previous page is not displayed and gives me "Page not found" Error. Any ideas how to make it work
<input...
|
by: Lynn |
last post by:
Hello,
I have a website that is working fine. I have just turned on "option strict"
and am getting an error with the parts of my code. I have fixed everything
but this section, which has me baffled.
I am getting the error "option Strict On disallows late binding", and the
error is referring to this line of code: (3rd line in my sub below)
Select Case sender.Parent.ID
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |