I'm a little confused.
in this program ive writted from a book it says
it sets a variable Value and says, if number > 20, set Value = 1 else Value = 0 right. if its 1, display an error message otherwise continue with program.
is Value a default variable built for this specific task?
i am just wondering. if it isnt built for this, can someone just explain how value is making the decision to display error or not because its not in the main function of the program and it isnt set to any other variable or whatever. im a little confused.
using namespace std;
typedef unsigned short int USHORT;
short Factor(USHORT, USHORT*, USHORT*);
USHORT Number, Squared, Cubed;
cout <<"Enter number (0-20): ";
cin >> Number;
Error = Factor(Number, &Squared, &Cubed);
cout <<"Number: " << Number << "\n";
cout <<"Square: " << Squared << "\n";
cout <<"Cube: " << Cubed << "\n";
cout <<"Error Encountered!!!\n";
short Factor(USHORT n, USHORT *pSquared, USHORT *pCubed)
short Value = 0;
if(n > 20)
Value = 1;
*pSquared = n*n;
*pCubed = n*n*n;
Value = 0;
Im just confused as to how Value knows to display ERROR