Need help with Unexpected Token Error & Unable to resolve identifier

Normally I do fairly well when setting up a start-up menu, but every since I starting incorporating functions into my program as requested I have been having Unexpected Token and Unable to resolve identifier errors. I am currently using NetBeans 7.1.1 to do my c++ projects. In the past when I get unexpected token errors it was usually due to a misplaced or missing curly bracket or semicolon. However this time I am unable to find the problem. In addition I will leave all the cases empty except for the first one, since I it has been causing errors to all of my programs. Therefore can someone please help me fix these errors?

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
152
/* 
 * File:   main.cpp
 * Author: Kevin Vo
 * Purpose: Using menu for challenge selection
 * Chapter: Gaddis Chapter 6
 * Problem 1 -> Finds an item's retail price w/ markup % & wholesale cost
 * Problem 2 -> Finds the area of a rectangle
 * Problem 3 -> Determines which 4 division of a company made the most
 * Problem 4 -> Determines which region has the fewest accidents reported
 * Problem 5 -> Figures out the falling time of the object
 * Problem 6 -> Calculates the kinetic energy of an object
 * Problem 7 -> Displays a table with Fahrenheit & Celsius temperature(0F-20F) 
 * Problem 8 -> Heads or Tails generator
 * Problem 9 -> Calculates the present value to deposit in savings account
 * Problem 10 -> Determines the test scores' average
 * Created on May 10, 2012, 7:18 AM
 */

#include <cstdlib>
#include <iostream>
#include <iomanip>

using namespace std;


int main(int argc, char** argv) {
    int choice;
    bool loop = true;
    do{
        
        cout<<"\n***********************\n";
        cout<<"Type 1 to solve problem 1\n";
        cout<<"Type 2 to solve problem 2\n";
        cout<<"Type 3 to solve problem 3\n";
        cout<<"Type 4 to solve problem 4\n";
        cout<<"Type 5 to solve problem 5\n";
        cout<<"Type 6 to solve problem 6\n";
        cout<<"Type 7 to solve problem 7\n";
        cout<<"Type 8 to solve problem 8\n";
        cout<<"Type 9 to solve problem 9\n";
        cout<<"Type 10 to solve problem 10\n";
        cout<<"Type anything else to quit with no solutions.\n";
        cin>>choice;
        
        switch(choice){
            
                case 1:{
float calculateRetail(float, float);//Function prototype
int main(int argc, char** argv){//<-- unexpected token error
    float wholesaleCOST;
    int Markup;
    
    //Output prompt and user input for program
    cout<<"Please enter the wholesale cost and markup percentage of an item to "
        <<"determine its retail price.\nWholesale Cost: ";
    cin>>wholesaleCOST;
    cout<<"Markup Percentage: ";
    cin>>Markup;
    
    //If statement for input validation (no negative digits) 
    if (wholesaleCOST < 0 || Markup < 0){
        cout<<"Input Validation: Do not accept negative value for either the "
            <<"wholesale cost of the\nitem or the markup percentage.\n";    
    }
    
    else{      
calculateRetail(wholesaleCOST, Markup);//function call    
    }

    return 0;
}

//Function
float calculateRetail(float NUMwhole, float NUMmark){//<-- unexpected token error & unable to resolve identifier NUMwhole & NUMmark
    float totalRetailPrice;
    
    totalRetailPrice = ((NUMwhole * (NUMmark / 100)) + NUMwhole);//<-- unexpected token error & unable to resolve identifier NUMwhole & NUMmark
    
    //output display of the result
    cout<<"If an item's wholesale cost is "<<fixed<<setprecision(2)<<showpoint
            <<NUMwhole<<" and its mark up percentage is "<<NUMmark//<-- unexpected token error & unable to resolve identifier NUMwhole & NUMmark
            <<"%, then the\nitem's retail price is "<<totalRetailPrice<<".\n"; 
return totalRetailPrice;}
                
                        
                };break;
        
                case 2:{
                

        
                };break;
        
                case 3:{
                
               
        
                };break;
        
                case 4:{
                
                
        
                };break;
        
                case 5:{
                
                
        
                };break;
        
                case 6:{
                
                
        
                };break;
        
                case 7:{
                
                
        
                };break;
        
                case 8:{
                
                
        
                };break;
        
                case 9:{
                
                
        
                };break;
        
                case 10:{
                
                
        
                };break;
    
    default:{
                        cout<<"Exit?"<<endl;
                        loop=false;
                        break;
                }
    }
    }while(loop);

    return 0;
}
You define function main twice one into another

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
int main(int argc, char** argv) {
    int choice;
    bool loop = true;
    do{
        
        cout<<"\n***********************\n";
        cout<<"Type 1 to solve problem 1\n";
        cout<<"Type 2 to solve problem 2\n";
        cout<<"Type 3 to solve problem 3\n";
        cout<<"Type 4 to solve problem 4\n";
        cout<<"Type 5 to solve problem 5\n";
        cout<<"Type 6 to solve problem 6\n";
        cout<<"Type 7 to solve problem 7\n";
        cout<<"Type 8 to solve problem 8\n";
        cout<<"Type 9 to solve problem 9\n";
        cout<<"Type 10 to solve problem 10\n";
        cout<<"Type anything else to quit with no solutions.\n";
        cin>>choice;
        
        switch(choice){
            
                case 1:{
float calculateRetail(float, float);//Function prototype
int main(int argc, char** argv){//<-- unexpected token error 


And the compiler says that this is not allowed.
I tried renaming the inner "int main" but there's still the same error, what else should I do?
Last edited on
This is the report that I would receive after running the program. The program works fine on its own but once inserted in to the switch statement for to be part of the menu, I doesn't run correctly anymore.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/DangerousPirate/Documents/NetBeansProjects/Vo_Kevin_Gaddis_Chapter_6_Problems'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_1-Windows/vo_kevin_gaddis_chapter_6_problems.exe
make[2]: Entering directory `/cygdrive/c/Users/DangerousPirate/Documents/NetBeansProjects/Vo_Kevin_Gaddis_Chapter_6_Problems'
mkdir -p build/Debug/Cygwin_1-Windows
rm -f build/Debug/Cygwin_1-Windows/main.o.d
g++.exe -c -g -MMD -MP -MF build/Debug/Cygwin_1-Windows/main.o.d -o build/Debug/Cygwin_1-Windows/main.o main.cpp
main.cpp: In function `int main(int, char**)':
main.cpp:50: error: a function-definition is not allowed here before '{' token
main.cpp:50: error: expected `,' or `;' before '{' token
main.cpp:75: error: a function-definition is not allowed here before '{' token
main.cpp:75: error: expected `,' or `;' before '{' token
make[2]: *** [build/Debug/Cygwin_1-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-Debug.mk:65: recipe for target `build/Debug/Cygwin_1-Windows/main.o' failed
make[2]: Leaving directory `/cygdrive/c/Users/DangerousPirate/Documents/NetBeansProjects/Vo_Kevin_Gaddis_Chapter_6_Problems'
nbproject/Makefile-Debug.mk:58: recipe for target `.build-conf' failed
make[1]: Leaving directory `/cygdrive/c/Users/DangerousPirate/Documents/NetBeansProjects/Vo_Kevin_Gaddis_Chapter_6_Problems'
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed


BUILD FAILED (exit value 2, total time: 1s)
Topic archived. No new replies allowed.