vendredi 27 février 2015

Why isn't my if statement working?

I was working on a calculator that can operate in C. Suddenly, an error popped up saying it was expecting an expression. I wonder why the if statement isn't working. Here is the code that I typed in!



#include <stdio.h>

int main(int argc, const char * argv[]) {

int symbol;
int numberOne;
int numberTwo;

printf("+,-,/,*?");
symbol = scanf("%d", &symbol);

if (symbol==*)
{
printf("Please enter first number.");
numberOne = scanf("%d", &numberOne);
printf("%d %d = ?" , numberOne , symbol);
}
return 0;
}


It said that there was an error on the if statement. Please report my error. :D


Aucun commentaire:

Enregistrer un commentaire