Need Help - Factorial Function

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.

The code so far:
#include <stdio.h>

void Step1(int num1)
printf(“Enter Number.\n”);
scanf("%d%*c", &num1);

void Step2()


int main()


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.

Help would be greatly appreciated.
Step1() needs to return a value back to main, so it can't have a void return type. What should you change to fix that?

Step2() needs to take in a number and calculate the factorial. Currently, it doesn't take in anything. What should you change to fix that?
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:

int GetValueFromUser()
      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:

int returnvalue = GetValueFromUser();
Topic archived. No new replies allowed.