Simple If loops.

bool check(char score, int test)
{
if ( score = 'A' && test>= 90 && test <= 100 )
{
return true;
}

how come when I do

check('A', 79)

It returns true?
You didn't specify an alternate return value, and some compilers assume it to be the same when they expect a return value:
1
2
3
4
5
6
7
8
bool check(char score, int test)
{
  if (score == 'A' && test>= 90 && test <= 100)
    {
      return true;
    }
  return false; //this is the necessity!
}


Also, note my use of '==' rather than '='. This is a common mistake, that I'm sure you forgot. :P

= is for assigning values
== is for comparing values
can you get on aim? i want to show you what I have.
Topic archived. No new replies allowed.