This is my assignment: Write a program to helps health care staff keep track of a patient's cholesterol level. It needs to have a main function that calls another function, and the function must be declared before the main function using a function prototype. A function must be called checkLDL, and should assign a value to the parameter.
These are the values:
<100 Optimal
<130 Near optimal
<160 Borderline high
<190 High
>=190 Very High
I am not understanding functions at all. I don't even understand what application they have. Can someone please help explain them to me, and help explain what to do/where I'm going wrong? I've started a program but it is a complete mess.
#include <iostream>
#include <string>
using namespace std;
void level (int);
int main()
{
void level (int);
return 0;
}
void level (int)
{
int checkLDL = 0;
int clevel;
string name;
char Optimal;
char Near Optimal;
char Borderline high;
char High;
char Very High;
cout <<"What is your cholesterol level? " <<endl;
cin>>checkLDL;
while (checkLDL !=0)
{
if (checkLDL<130)
clevel = Optimal;
if (checkLDL<130 && checkLDL<100)
clevel=Near Optimal;
if (checkLDL<159 && checkLDL<130)
clevel = Borderline high;
if (checkLDL>190 && checkLDL>159)
clevel = High;
else (checkLDL>190);
clevel = Very High;
}
cout <<"Your cholesterol number is : " << checkLDL <<endl;
cout <<"Your cholesterol level is : " << clevel <<endl;
}