1 2 3
|
/*Counts all numbers from 1000 and stops at 0.
Allnumbers are now stored in variable 'num'*/
for (unsigned int num = 1000; num > 0; --num)
|
The variable 'num' is of unsigned int type, and not an array.
It cannot store more than 1 integer at a time.
So, all numbers are not stored in variable 'num'.
It will count from 1000 and stops at 0, each time it iterates the loop,
That number is stored in num.
So at the end of the loop, num has the value 0.
Easier way to solve this in your case is to put parenthesis for the 'for' loop {}.
And call the doMath() function from within the for loop.
http://www.cplusplus.com/doc/tutorial/control/
Next, doMath() function is not taking any arguments.
And also, you are not catching the return value in any variable.
This function needs to take input (num in your case), and the return value needs to be captured in another variable.
Please read more about function arguments and how to use return types.
http://www.cplusplus.com/doc/tutorial/functions/
Hope this helps.