I've about reached the limit of help that I personally would provide to someone who seems to be putting minimal effort into debugging their own code. We've helped you with several bugs, and each time, you turn back to the forum immediately after running the new program, without demonstrating approaches you've taken to try and resolve whatever bug shows up next.
I'll provide you some help here, but it may not be the help you want. I'm doing you a favor here by saying that TheIdeasMan actually pointed you in the right direction with the warning levels. Look at what the error messages mean, and what parts of your program they highlight.
Additionally, consider ways to see the inner workings of what your program is doing, that will allow you to test and debug your own code. Think to yourself, what can I do to my program to see what the value of a variable is at a certain point in the program? How might I show what value a function is returning to make sure it's doing what I expect it to? This is an immensely useful concept in debugging.
I do apologize, mastakhan. I honestly can't put into words how thankful and appreciative I am of the help you guys are giving me. I'm at a point where I'm so fed up with trying to figure out the issues with this program on my own that I almost gave up hence why it appeared that I was giving it minimal effort.
TheIdeasMan really helped me and thanks to the debugger I sorted out the warnings. One thing I would like to mention is that the powerpoint lectures which our professor provided us with did not mention that we need to return a value in any case.
#include <iostream>
using namespace std;
//function prototype
bool isEven(int);
int main()
{
int value;
cout << "Please enter an integer number: ";
cin >> value;
if(isEven(value)) //function call is used as a boolean expr
{
cout << value << " is an even number." << endl;
}
else
{
cout << value << " is an odd number." << endl;
}
system("PAUSE");
return 0;
}
/*The isEven function returns true if the parameter is even and false otherwise*/
bool isEven(int number)
{
if((number % 2) != 0)
return false; //the number is odd if there’s a remainder
else
return true; //otherwise its even
}
This is the slide from our lecture I was using to help me which should explain to you guys why I was so confused with the whole warning thing because we never actually learned that we need to return a value in any case and not just specific case.