Hello, I'm in my first year of computer science and need some help in C++.
The question is:
Write a program consisting of two functions (plus main). The first function should read in a number and then pass this back to main. This value should then be passed into a second function that calculates and displays the factorial.
No idea if its right but my fiend and I are stumped. The layout is based of the previous question asking:
Write a simple function (not an entire program at this point) that prints your name and lab time on separate lines. These values may be hard coded into your program. Show your tutor and then use this function in the other programs you write this week.
Don't be confused by the wording of the requirement. You are simply calling another function to read in a value and the function should then return the value the user entered. So if you have declared a function like so:
1 2 3 4 5
int GetValueFromUser()
{
scanf("%d"...)
return value;
}
you can return the value from the function by creating a variable inside main and setting the value of that variable to the value returned by the function.
Like so: