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.

Basically I have this but entering -10 doesnt end it???

[// 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;
mark = 1;
while (mark != -10, mark++){
cout << "Enter mark out of 100 , enter -10 to end: ";
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;
}
]

You have an error here: while (mark != -10, mark++) Change it to: while (mark != -10) And the program will end when -10 is entered

The next time you post code, please use code tags

Thanks very much I cant believe i didnt realise that , works perfectly now .

I just joined today though and am wandering what you meant by PM's asking for help will be ignored?

Thanks

You can send Private Messages (PM) to people by clicking on their name and select 'send Private Message'
But I got a lot of PM's of people begging me for source-code and it irritated the hell out of me.
So I added a signature PM's asking for help will be ignored.. so everyone can see that PMing me won't help them.
The signature will display in every message I post.

To add a signature of your own, goto 'control panel' (top of the screen) and click 'edit signature'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.