Im trying to assign a value to an Integer (Yeah I know probably extremely simple but im completely new to C++).
How do I do this?
This is what I have for now as to declare the variables:
1 2 3 4 5
private:
// -------------------------
// Member functions
// -------------------------
int a, b, c;
I have to assign certain values to them.
Here is the actual assignment:
Declare in IntDoubleLab.h, three variables of type int.
Assign in IntDoubleLab.cpp the value -2147483640 to the first variable, and -10
to the second variable. Compute the sum of these two variables, and store in the
third variable. Print the contents of these variables on the screen. Test it, and
note that you get a positive result, although we added two negative numbers!
Well, with IntDoubleLab.h, that is a header. Have you created the header yet? If so, then in the header you would do this:
1 2 3
int varType1 = 0;
int varType2 = 0;
int varType3 = 0;
or...
int varType1 = 0, varType2 = 0, varType3 = 0;
Always initialize them to '0' so that they don't have any other values at the start.
------------------------------------------------------------------------------------------------------------------