### im having a problem with a grades prorgram

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
float points, pospo, extra, percentage, response, pwec;
int yes, no;

cin >> points >> pospo;

percentage = (points/ pospo) * 100.0;
pwec = ( points + extra ) / pospo * 100.0;

cout << " you got a " << percentage << "% ";

if (percentage > 89 && percentage < 101)
cout << " You got an A! ";

if (percentage > 79 && percentage < 90)
cout << " You got a B! ";

if (percentage > 69 && percentage < 80)
cout << " You got a C! ";

if (percentage < 70)
cout << " You got an F! ";

system("PAUSE");

// Output

cout << " Did you get any extra credit? ";
cin >> response;

if ( response = yes )
cout << " alright, how many points: ";

cin >> extra;

cout << " You got a " << pwec << "% ";

if (pwec < 101 && pwec > 89)
cout << " With extra credit you have an A! ";

if (pwec < 90 && pwec > 79)
cout << " With extra credit you have a B! ";

if (pwec < 80 && pwec > 69)
cout << " With extra credit you have a C! ";

if (pwec < 70)
cout << " You still have an F with extra credit ";

if (response = no)
cout << " Thank you for using this program! ";

system("PAUSE");
return EXIT_SUCCESS;
}
What is happening is hard to describe. After asking if extra credit was received , it doesn't let the user give any input and instead jumps right over the
cin >> extra;

(extra is the variable for extra credit). and goes strait to the the output, and treats extra as if it were 0, because it still gives an output percentage
You must be in the same classroom as "tonic1713" who posted this: http://www.cplusplus.com/forum/general/81545/

Topic archived. No new replies allowed.