- Code: Select all
// ************I Am having problems with this programit********************
// some of this programm only works on windows cpp
//#include "stdafx.h"// This line is only needd on a windows cpp
#include <iostream>// includes the file iostream
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
for (;;) // for(;;) means that it will be looping for infinity times.
// click the x botton in the window to exit
{
double x,y;
cout <<endl<< "Enter the first grade, then the second grade seperated by a space: ";
// enter what you want the output message should be
// prompting the user for x and y seperated by a space
cin >> x; // @@@@@ x input of 13 vise versa
cin >> y; // @@@@@ y input of 100 vise versa
cout << endl;
cout << endl;
if(( x > 100 )||( y > 100))//incase the enter number greater than 100
{
cout<< "Please enter a number between 100 and 0!!"<<endl;
}
else
{
if ((x <0 )||( y < 0))//incase the enter number greater than 100
{
cout<< "Please enter a number between 100 and 0!!"<<endl;
}
}
if ( ( (x >= 0) && (y >= O) )&& ( (x <= 45) && (y <= 45) ) )
{
cout << "Fail!"<<endl;
// What happens if x and y are less than 45
}
else
{
double z;
z = (x + y)/2;
if (100==z)
{
cout << "Congrats! You got a 100% Average!!"<<endl;
// What happens if both x and y are equal to 100
}
else
{
if ( ( (z > 45) && (z< 100) ) && ( ( ( x < 100) && (y < 100) ) || ( (x > 45 ) || ( y > 45) ) ) ) // This line i suspect is the
// problem
{
cout << "You Pass!"<<endl; // Enter outputfor passing
}
}
}
cout << endl;
cout << endl;
cout << "To input two new numbers press any key....... \n\n\n";
system ("pause");// waits to procede, only needed on windows cpp
system ("cls");// clears screen in command window
}
return 0;
