Some help

I am trying to learn C++, and found these projects online. What I have below is as far as I am. Anyone got any tips?

Question commented at bottom.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>

using namespace std;
	
int whole;
int whole2;
int whole3;
int whole4;

int Double() {
	whole2 = whole * 2;
}

int GetSmaller() {
	whole3 = whole2 - 2;
}

void ShowMe() {
	cout << whole4 << endl;
}
int main()
	{

	cout << "Please enter the whole number: " << endl;
	cin >> whole;

	whole4 = whole3 * 4;

	Showme();
}

/*
Review 6;

Write a C++ program that will do this:
1.	In the main() function, ask the user to enter a whole number.
2.	Call a function named Double(), sending the number to this function.  Inside the function, you want to double the number before returning it to the main() function.
3.	Now have your main() function call the GetSmaller() function, sending the new number to this function.  Inside this function, you should subtract 2 from the number before returning the new number to the main() function.
4.	Now take the value and multiply it by 4 (still in the main() function).
5.	Call a function named ShowMe() which will simply display final number.
Be careful as to which functions are “void” functions and which are “value returning” functions.  None of these should need to use “reference parameters” … but don’t worry, that’s coming.

Review7
Modify your Review6 program so that it uses only “void” functions, some of them using “reference parameters” to pass modified values around.  The only return statement should be in your main() function.  Otherwise, this should appear to function exactly as it did in Review6.


*/
Remove global variables.

Functions can take parameters and return values. The exercises even demand that.
http://www.cplusplus.com/doc/tutorial/functions/

Your functions don't do so. Yet.
Topic archived. No new replies allowed.