DEV Community

grool
grool

Posted on

[Error] Id returned 1 exit status

include

include

using namespace std;

double input(double a1, double a2, double sw1, double sw2, double q1, double q2, double e);
double calculator(double a1, double a2, double sw1, double sw2, double q1, double q2, double e);
void printingresult(int final);
void loop(char ans);
int main() {

char fname[50], ans;
double assign1, assign2, seatwork1, seatwork2, quiz1, quiz2, exam;
double final;

cout << "Enter student name: ";
cin >> fname;
input(assign1, assign2, seatwork1, seatwork2, quiz1, quiz2, exam);
final = calculator(assign1, assign2, seatwork1, seatwork2, quiz1, quiz2, exam);

do {
    printingresult(final);
    cout << "\n\tTry another Y/N: ";
    cin >> ans;
} while (ans != 'N' && ans != 'n');

system("pause");
return 0;
Enter fullscreen mode Exit fullscreen mode

}

double input(double a1, double a2, double sw1, double sw2, double q1, double q2, double e)
{
cout << "\nEnter grade for assignment 1: ";
cin >> a1;

cout << "Enter grade for assignment 2: ";
cin >> a2;

cout << "\nEnter grade for seatwork 1: ";
cin >> sw1;

cout << "Enter grade for seatwork 2: ";
cin >> sw2;

cout << "\nEnter grade for quiz 1: ";
cin >> q1;

cout << "Enter grade for quiz 2: ";
cin >> q2;

cout << "\nEnter grade for major exam: ";
cin >> e;
Enter fullscreen mode Exit fullscreen mode

}

double calculation(double a1, double a2, double sw1, double sw2, double q1, double q2, double e)
{
double x;
x = (((a1 + a2) / 2) * .10) + (((sw1 + sw2) / 2) * .20) + (((q1 + q2) / 2) * .30) + (e * .40);
return x;
}

void printingresult(double final)
{
cout << "\n\nFinal Grade: " << final << endl;
if (final >= 99) {
cout << "1.00" << endl;
}
else if (final >= 96) {
cout << "1.25" << endl;
}
else if (final >= 93) {
cout << "1.50" << endl;
}
else if (final >= 90) {
cout << "1.75" << endl;
}
else if (final >= 87) {
cout << "2.00" << endl;
}
else if (final >= 84) {
cout << "2.25" << endl;
}
else if (final >= 81) {
cout << "2.50" << endl;
}
else if (final >= 78) {
cout << "2.75" << endl;
}
else if (final >= 75) {
cout << "3.00" << endl;
}
else if (final <= 74) {
cout << "5" << endl;
}

}

Discussion (0)