Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

C++ need help po

God love us

Amateur
Advanced Member
Messages
134
Reaction score
0
Points
26
Bakit kaya always 5.0 result sa Equivalent Grade:
any help po please

Code:
#include <iostream>
#include <string.h>
using namespace std;

int main()
{

char sname [50], snum[50];
int att1, att2, cs1, cs2, q1, q2, ME, FE;
float MG = 0, FG = 0, FR = 0;

cout << "Welcome to my First Program" <<endl;
cout << "\n\n";
cout << "Student Name \t";
cin.getline(sname, 50);
cout << "Student Number \t";
cin.getline(snum, 50);
cout << "\n\n";
cout << "Calculation for Midterm Grade" <<endl;
cout << "\n\n";
cout << "Attendance \t";
cin >> att1;
cout << "Class Standing \t";
cin >> cs1;
cout << "Quizzes \t";
cin >> q1;
cout << "Midterm Exam \t";
cin >> ME;
MG = (att1*.10) + (cs1*.20) + (q1*.30) + (ME*.40);
cout << "You Midterm is \t" <<MG;

cout << "\n\n";
cout << "Calculation for Final Grade \t" <<endl;
cout << "\n\n";
cout << "Attendance \t";
cin >> att2;
cout << "Class Standing \t";
cin >> cs2;
cout << "Quizzes \t";
cin >> q2;
cout << "Final Exam \t";
cin >> FE;
FG = (att2*.10) + (cs2*.20) + (q2*.30) + (FE*.40);
cout << "Your Final is \t" <<FG

<<endl;

FR = (MG + FG )/2;
if(FR>=75)
cout<<"Passed";
else if (FR<=75)
cout<<"Failed"<<endl;
cout<<""<<endl;
	
cout<<"\nFinal rating: "<<FR;
cout<<"\nRemarks: ";
if(FR>=75)
cout<<"Passed";
else
cout<<"Failed";
cout<<"\nEquivalent Grade: ";
if((FR==99)||(FR==100))
cout<<"1.0";
else if((FR==97)||(FR==98))
cout<<"1.1";
else if((FR==95)||(FR==96))
cout<<"1.2";
else if((FR==93)||(FR==94))
cout<<"1.3";
else if((FR==91)||(FR==92))
cout<<"1.4";
else if(FR==90)
cout<<"1.5";
else if(FR==89)
cout<<"1.6";
else if(FR==88)
cout<<"1.7";
else if(FR==87)
cout<<"1.8";
else if(FR==86)
cout<<"1.9";
else if(FR==85)
cout<<"2.0";
else if(FR==84)
cout<<"2.1";
else if(FR==83)
cout<<"2.2";
else if(FR==82)
cout<<"2.3";
else if(FR==81)
cout<<"2.4";
else if(FR==80)
cout<<"2.5";
else if(FR==79)
cout<<"2.6";
else if(FR==78)
cout<<"2.7";
else if(FR==77)
cout<<"2.8";
else if(FR==76)
cout<<"2.9";
else if(FR==75)
cout<<"3.0";
else
cout<<"5.0";
cout<<endl;

cout<<"General Classification: ";
if((FR>=90)&&(FR<=100))
cout<<"Excellent";
else if((FR>=90)&&(FR<=94))
cout<<"Superior";
else if((FR>=85)&&(FR<=89))
cout<<"Very Good";
else if((FR>=80)&&(FR<=84))
cout<<"Good";
else if((FR>=75)&&(FR<=79))
cout<<"Fair";
else
cout<<"Poor";

return 0;
}
 
FR is declared as float
float MG = 0, FG = 0, FR = 0;
You have a conditional statement that checks for the exact equivalent
else if(FR==90)
Final Rating will not be rounded off to Integer because it is declared as Float
float MG = 0, FG = 0, FR = 0;

Para macorrect, Modify your conditional statement for checking the values between 99 and 100 by using greather/less than
Ex.
FR>=99&&FR<=100

Do the rest.
 
FR is declared as float

You have a conditional statement that checks for the exact equivalent

Final Rating will not be rounded off to Integer because it is declared as Float


Para macorrect, Modify your conditional statement for checking the values between 99 and 100 by using greather/less than
Ex.


Do the rest.

Kaya pala kuha ko na palitan ko nalang instead of Float gawin kong integer maraming salamat po
 
Back
Top Bottom