I'm prepping for class. Brand new to this. Trying to do a basic fucntion decleration, function call, and function definition. program is suppose to enter a positive or negative integer than return either a 'P' or 'N'. I can't figure out how to do the function call correctly so it doesn't return the character. Can anyone help?
#include <iostream>
using namespace std;
//Program to receive integer and display P for positive or N for negative.
//function call practice.
char answer (double number);
int main()
{
int choice;
double number;
cout << "enter a positive or negative number.\n";
cin >> choice;
thanks againtry, worked great except using
if (number>0) in the definition would only return N every time. making it if (answer>0) only returns a P value each time. any idea what is wrong with the if statement?
Ahh my mistake, I was missing a line. I didn't copy and paste yours completely but rather added to mine what I thought I was missing from yours. And I missed a line. copied yours and That took care of it! Thank you!! works well! I didn't realize how big of a deal that cout<<choice<< would be, did the trick. much to learn on my part..