Hi all I am learning C++ , but am still pretty new to it I have one problem I am writing a program to simply input a mark and then it gives the corresponding symbol and according to the symbol if its anything above an E it displays you pass and if not it displays you dont , I have had no problem writing this :
[ // Symbol issuing program as per mark out of 100.
#include <iostream>
using namespace std;
int symbol(int mark)
{
if (mark >= 0 && mark <= 39)
return 70;
if (mark >= 40 && mark <= 49)
return 69;
if (mark >= 50 && mark <= 59)
return 68;
if (mark >= 60 && mark <= 69)
return 67;
if (mark >= 70 && mark <= 79)
return 66;
if (mark >= 80 && mark <= 100)
return 65;
}
bool passOrNot (char symb)
{
char A, B, C, D, E , F;
if (symb <= 68 )
return 1;
}
int main()
{
int mark;
char symb;
cout << "Enter marks out of 100 followed by -10 to end inputs and display the results: ";
cin >> mark;
symb = symbol(mark);
cout << "Symbol corresponding to " << mark << " is " << symb;
if (passOrNot (symb))
cout << " You Pass Congratulations!"<< endl;
else
cout << " Unfortunately you fail" << endl;
return 0;
}
]
Except now I want to impliment a While loop into it so that I can enter a number of marks followed by -10 (or any defined number below 0) to end my inputs and display the results of each mark , yet everything I try doesnt work , it either gets stuck in a loop or simply stops on my 1st number entered , Please could somebody help me out here.