if statement and a function
I have a function that will return an integer. I set the integer at the beginning to 0 and at the end, an if statement sets it to 1 if the function determines a problem.
How could I write a bit of code that will run this function if the function returns 0, and if the function does not return 0, move on to the else statement?
Is this correct?
if(exampleFunction(variable) == 0)
cout << "run the if part" << endl;
cout << "run the else part" << endl;
That seems to be fine.
Topic archived. No new replies allowed.