Having trouble getting a user defined function to work correctly. I only want it to check if the number are below 12 or above 18. Then i want it it cout a warning. But it is on the screen at att times. I do not want this. Here is the code..any help would be appreciated. Thanks
int warn(int, int, int,int ) //user defined function is not working properly
{
int min_credit=12;
int max_credit=18;
int num_Courses; //the number of courses
int num_credit; //the number of credits
if ( num_Courses * num_credit >min_credit )
{cout<<"Taking less credits than required for full time";}
else
( num_Courses * num_credit> max_credit);
{cout<<"Taking more credits than required for full time";}
return(0);
}
int main()
{
string meal;
int student_Id;
int num_Courses;
char degree;
bool inState;
bool I_home;
bool O_away;
char val;
char U;
char G;
char student;
int credit=3;
char hours;
int a; //should not have todeclare part of function
int b; //should not have to declare part of function
cout <<" "<< endl;
cout <<" "<< "Tuition Calculations Program"<<endl<<endl;
cout <<" "<< "Enter your student id: " ;
cin >> student_Id; //User input for ID
cout << endl << endl;
cout <<" "<< "Which program are you in? \n";
cout <<" "<< "([U]ndergraduate, [G]raduate): ";
cin >> degree;
degree = toupper(degree);
cout <<endl;
cout <<" "<< "Enter the number of courses you are taking: ";
cin >> num_Courses;
cout << endl <<endl;
cout <<(" ")<<"I = In-state \n O = Out-of State"<<endl;
cout <<(" ") <<"Are you an in-state or out-of state resident ";
cout <<(" ") <<"(I/O)? ";
cin>>val;
if (val == 'I')
{inState = I_home;}
else
{inState = O_away;}
cout<<(" ") <<"Do you have a meal plan? (yes or no, all lowercase) ";
cin>>meal;
cout <<endl<<endl<<endl;
cout <<showpoint<<fixed<<setprecision(2);
cout <<"\t\tPENNY LANE UNIVERSITY TUITION BILL"<<endl<<endl;
cout <<(" ")<<"Student Id;\t\t"<<student_Id<<endl;
cout <<(" ")<<"Program:\t\t"<<degree<<endl; //last statement
cout <<(" ")<<"Credit Hours:\t\t"<<num_Courses * credit<<endl;