program wont go past the switch

the program compiles fines the menu shows up but once i make a selection it does not switch to the program please help ..... also how do i make it return to the menu after im done with choosen function

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
 #include <iostream>
#include <string>

using namespace std;

int hw1(); 
void hw2(string word);
void hw3(string word);
void hw4(string word);
void hw5(string word);
void hw6(string word); 
void hw7(string word);
void closed(string word);

int number1; 
 int number2; 
 int number3; 
 int smallest;
 int largest; 
 int sum;

double average; 
 int product;
 int choice;


int main() 
{
		choice; 
	
	
	cout	 << " Welcome to my final C++ program \n " 
			 << " Please choose from the following selections \n\n"


			 <<" 1: Homework 1.\n "
    		 <<" 2: Homework 2.\n "
    		 <<" 3: Homework 3.\n "
			 <<" 4: Homework 4.\n "
    		 <<" 5: Homework 5.\n "
			 <<" 6: Homework 6.\n "
			 <<" 7: Homework 7.\n "
			 <<" 8: Exit.\n\n " ;
	
					  cin >> choice;
		

					
		switch (choice)
		{
	
		case 1:
        cout << "you have selected \n";
        hw1() ; 
        break;
		


     default: cout << "Your selection must be between 1-8 \n";
		
		}
}
	 int hw1()
	
	 {

		 cout << "Input three different Numbers: "; 
			cin >> number1 >> number2 >> number3;
			largest = number1; 

		if (number2 >= largest)
			largest = number2;
 
		if (number3 >= largest) 
			largest = number3; smallest = number1;

		if (number2 < smallest)
			smallest = number2;

		if (number3 < smallest)
			smallest = number3;
 
		cout << "The answers are...\n" 

			 << "Largest Value:" << largest << std::endl

			 << "Smallest Value:" << smallest << std::endl

  			 << "Sum: " << (sum = (number1 + number2 + number3)) << std::endl

			 << "Average: " << (average = (number1+number2+number3)/3.0f) << std::endl

			 << "Product: " << (product = (number1*number2*number3)) << std::endl;

		system("pause");
		return 0;
	}
Topic archived. No new replies allowed.