#include "iostream"
using namespace std;
float Result(float home, float assig, float test)
{
return (home/5+assig*3/10+test/2);
}
int main()
{
float maxim_rating;
cout << "Enter a maximum rating: ";
cin >> maxim_rating;
float home, assig, test;
cout << "\nEnter a mark for a homework: ";
cin >> home;
cout << "Enter a mark for an assigment: ";
cin >> assig;
cout << "Enter a mark for a test: ";
cin >> test;
float result = Result(home, assig, test);
cout << "Your total result is: " << (result/maxim_rating)*100 << "%"<<endl;
if (result < maxim_rating*6/10)
{
cout << "You fail." << endl;
}
else
{
cout << "You pass." << endl;
}
system("pause");
return 0;
}
In this case the maximum rating is entered in the beginning of a program.
Comments
Leave a comment