Include Source

The title pretty much says it all. I've got my Periodic Table program working, though still in the process of adding elements. I have a header file with all of the elements listed it as seperate functions, and I have other header files to refine searches.

ActElements.h \\ Actinide series
GasElements.h \\ All Gas Elements
LanthElements.h \\ Lanthanide Series
LiquidElements.h \\ All Liquid Elements
etc, though it also includes transition and metalloids and that type of classifiaction.


This is my code from my header GasElements

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
#include "Elements.h"
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <windows.h>

using namespace std;

void FuncGasElements()
{
    system("cls");
    int Switch_Gas;
    cout << "          Press the number coresponding with the element.\n\n"
         << "1. Hydrogen\n"
         << "2. Helium\n"
         << "3. Nitrogen\n"
         << "4. Oxygen\n"
         << "5. Fluorine\n"
         << "6. Neon\n"
         << "7. Chlorine\n"
         << "8. Argon\n\n";

         cin >> Switch_Gas;

         // Switches the user input from above

         switch(Switch_Gas)
         {

         case 1:
         Hydrogen();

         case 2:
         Helium();

         case 3:
         Nitrogen();

         case 4:
         Oxygen();

         case 5:
         Fluorine();

         case 6:
         Neon();

         case 7:
         Chlorine();

         case 8:
         Argon();

         }



}



Each case statement it calls a function from the header file "Elements.h", the only problem is, once it calls that function, it goes to the next. How would I make it so it goes back to my source file and runs
int main()
?
1
2
3
4
5
6
7
switch(Switch_Gas)
         {

         case 1:
         Hydrogen();
         break; //add break
Thanks. I thought of it but didn't think it would work.
Topic archived. No new replies allowed.