Case ain't calling the function?

Well i'm forced to use the current funtions, loops etc. The code is not passing me any errors/warnings anymore during compilation, case is properly reading user input however isn't calling the function ;/ i've got no damn idea why and where to look further to solve the issue. I'll be greatfull if anyone could help me out with it pointing where is the issue and how possible i can solve the issue without changing the whole code.

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
#include <string.h>
#include <stdio.h>


char name[2], forname[15], username[2];
int number, fact;

//Functions
void showMenu();
int get_names();
int create_username(char name[10],char forname[15]);
int display_username(char username[2]);
int get_number();
int factorial(int number);
int display_factorial(int fact);

int main()
{
	clrscr();
	cout << "Welcome to the EPOS Options Ltd. \n"
	     << "Network Administration & Statistics Department's \n"
	     << "Pilot 'One Stop Shop' interface \n \n";

	int OPTION_CHOICE;		//menu choice

	//constants for menu choices
	const int	USERNAME_CHOICE = 1,
			FACTORIAL_CHOICE = 2,
			QUIT_CHOICE = 3;
	do
	   {
	    showMenu(); // Callout menu function
	    cin >> OPTION_CHOICE;

		//Validate menu selection
		while (OPTION_CHOICE < USERNAME_CHOICE || FACTORIAL_CHOICE > QUIT_CHOICE)
		{
			cout << "Please enter a valid menu choice: \n";
			cin >> OPTION_CHOICE;
		}

		//If user doen't want to exit the application
		if (OPTION_CHOICE != QUIT_CHOICE)
		{
			switch (OPTION_CHOICE)
			{
				case USERNAME_CHOICE:
					cout << "You have choosen option 1 \n";
					int display_username();
					break;

				case FACTORIAL_CHOICE:
					cout << "You have choosen option 2 \n";
					int display_factorial();
					break;
			}
		}
	   } while (OPTION_CHOICE != QUIT_CHOICE);
	   cout << "\n Thank You for using this application, and goodbye!";
	   getch();
	   return 0;
}

//Menu Function

void showMenu()
{
	cout	<<"Please choose one of the following options \n \n"
		<<"Option 1: To generate a personal username \n"
		<<"Option 2: To calculate a number's factorial \n"
		<<"Option 3: To Exit the application \n";
}

//Username Function
int get_names()
{
	char name[10];
	char forname[15];
	cout << "Please enter Your first name \n";
	cin >> name;
	cout << "Please enter Your second name \n";
	cin >> forname;
	create_username(name,forname);
	return create_username();
}

int create_username(char name[1],char forname[1])
{
	puts (username);
	strcpy(username,name);
	strcat(username,forname);
	display_username(username);
	return display_username();
}

int display_username(char username[2])
{
	cout << "Your Username is " << username << ". \n";
	getch();
	return main();
}

//Fractional's number function

int get_number()
{
	cout << "Please enter a number \n";
	cin >> number;
	factorial(number);
	return factorial();
}

int factorial(int number)
{
	for(int i=1;i<=number;i++)
	{
		fact=fact*i;
	}
	display_factorial(fact);
	return display_factorial();
}

int display_factorial(int fact)
{
	cout << "/n The Factorial of " << number << " is " << fact << endl;
	return main();
}
Topic archived. No new replies allowed.