Help Please, code isn't working

Can someone help me, i've written this code and it's not working but i'm really not sure why, until a few changes it was working.

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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
    int noteNumber, exit = 0;
    char input[5], str[256], mapName[30], mapNameInput[30], creatorName[15], creatorNameInput[15];
    
    ifstream rules("rules.txt");
    ifstream note1("note 1.txt");
    ifstream note2("note 2.txt");
    ifstream map("map.txt");
    ifstream creator("creator.txt");
    
        
    while(exit == 0)
    {
        cout << "Welcome to ";
        
        map.clear();
        map.seekg(0);
        while(map.getline(mapName, 30))
            cout << mapName;
            
        cout << " Adventure Map. \nThis Map was made by ";
        
        creator.clear();
        creator.seekg(0);
        while(creator.getline(creatorName, 15))
            cout << creatorName;
        
        cout << ".\nThis application was made by Aaron Walwyn.\n\n"
             << "To read a Note type 'Note' \nTo read the Rules tye 'Rules' \nTo exit Type 'Exit'"
             << "\n\nInput: ";
        cin >> input;
        cout << "\n";
        
        if ((strcmpi(input,"note")==0))
        {
            cout << "Note: ";
            cin >> noteNumber;
            cout << "\n";
          
            switch(noteNumber)
            {
                case 1:
                     note1.clear();
                     note1.seekg(0);
                     while(note1.getline(str, 256))
                         cout << str << "\n";
                     break;
                case 2:
                     note2.clear();
                     note2.seekg(0);
                     while(note2.getline(str, 256))
                         cout << str << "\n";
                     break;
                default:
                     cout << "\n\nThat is not a valid note number, please try again...\n\n";
            }
        }
        else if ((strcmpi(input,"rules")==0)) //Rules 
        {
             rules.clear();
                     rules.seekg(0);
                     while(rules.getline(str, 256))
                         cout << str << "\n";
        }
        else if ((strcmpi(input,"devmode")==0)) //Dev Mode
        {
            int devExit, passcheck;
            devExit = 0;
            
            passcheck = 0;
            
            while(devExit==0)
            {    
             ofstream map("map.txt");
             
             char passEnter[30];
             int devMenu;
             
             if (passcheck==0)
                 {                     
                     cout << "DEV MODE is password protected, please enter the password: ";
                     cin >> passEnter;
                     passcheck==1;
                 }
                     if ((strcmp(passEnter,"default")==0)) //password is entered here
                     {
                         system("CLS");
                         cout << "DEV MODE\n\n"
                              << "Select a menu option by typing the number\n"
                              << "1) Rename Map\n"
                              << "2) Create New Note\n"
                              << "3) Create Map Rules\n"
                              << "4) Change creator name\n"
                              << "5) Change DEV MODE password\n";
                         
                         cout << "\nMenu Choice: ";
                         cin >> devMenu;
                         
                         switch(devMenu)
                             {
                                 case 1:
                                      cout << "\nType what goes as the map name: ";
                                      cin >> mapName;
                                      map << mapNameInput;
                                      break;
                                 case 2:
                                      cout << "New note function goes here\n";
                                      break;
                                 case 3:
                                      cout << "Rules functions goes here\n";
                                      break;
                                 case 4:
                                      cout << "\nType the creator's name: ";
                                      cin >> creatorName;
                                      map << creatorNameInput;
                                      break;
                                 default:
                                      devExit = 1;
                             }
                     }
                 passcheck = 0;
                }
            }        
        
        else if ((strcmpi(input,"exit")==0)) //Exit 
        {
             exit=1;
        }
        }
        
        /*cout << "\n\n";     
         system("PAUSE");
        system("CLS");  */          
    }
    
    note1.close();
    note2.close();
    rules.close();
    map.close();
    
    cout << "Thanks for using this feature \nThis software was made by Aaron Walwyn. \nwww.youtube.com/actionmanmedia \nDo not distribute.\n\n";
    system("PAUSE");
    return EXIT_SUCCESS;
}
Last edited on
Saying "it doesn't work" and not explaining why you say so, and not explaining the expected proper behavior doesn't help much.

If you are getting a compilation error, then post it here including the line numbers (hopefully the line numbers will match the numbers in your code post). If you are getting a runtime error of some sort, also post it here and specify the line throwing the error.
Sorry i'll explain now...

The area which is causing the problems is the Dev area (labelled Dev Mode) ever since i added a IF statement (line 86) the program no longer runs and i get about 20 errors saying 'expected a ',' or ';' before '('

Here is a image of the errors: http://gyazo.com/05c65947bf9cdb7c3d8d808f62a8ffff.png
Last edited on
Your code is not properly aligned, which makes it hard to follow. I think the braces are not paired properly. If I counted them correctly, you have one closing brace too many.
Oh My, can't believe i didn't notice that :F thanks you so much for your help anyway.
Topic archived. No new replies allowed.