Error expected at the end of input../primary expression

Hi, I am writing a program and ive recive these two errors all of a sudden saying Error expected at the end of input and error expected primary expression at at the end of input... Can anyone figure out the error?
Line error is on the last line
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#include<iostream>
#include<cstdlib>
#include<conio.h>
#include<cmath>
   using namespace std;
int main ()
    {
int loopcount=0;
int total=0;
  int Total1=1;
char choice, choice1, choice2, choice3, choice4;
   int Answer,x,y;
   int NumbersAmount;
   int number;
 double x1,y1;
 double Answer1;
   double angle;
   system("COLOR 0c");
     cout<<"             Welcome to TwoSixEight Geeka Scientific Calculator\n";
   cout << "                      Coded by Jenell Joanne James\n\n";

  cout << " \n Enter the number of the function you'd like to calculate\n";
   do {
     cout<<"\t1 ~ Arithmetic Operations \n: ";
     cout<<"\t2 ~ Trigonometric Functions \n: ";
     cout<<"\t3 ~ Logarithmic Functions \n: ";
     cout<<"\t4 ~ Power Functions \n: ";
     cout<<"\t5 ~ Exit\n\n:";


     choice = getche();



     switch(choice)

     {
   case '1':

      {
   cout<< " \n\n Welcome to the Arithmetic Operations\n\n";
   cout<<" Enter the number of the operator you will like to select\n";
              cout<<"\t1 : Addition \n: ";
              cout<<"\t2 : subtraction \n: ";
              cout<<"\t3 : Multiplication \n: ";
              cout<<"\t4 : Division \n: ";
              choice1 = getche();
               switch(choice1)
                  {
                    case '1':
                             {
                            cout << "How many numbers are  you adding?\n";
                            cin >> NumbersAmount;

                             while (loopcount < NumbersAmount){
                               cout<<"Enter a number: ";
                               cin>>number;
                              total = total + number;
                                 loopcount = loopcount+1;

                            }
                             cout<<" Total is "<<total<<endl;


                              break;

                              }
                    case '2':
                          {
                       cout<<"Enter first number: ";
                      cin>>x;
                       cout<<"Enter an other number: ";
                       cin>>y;
                             Answer=x-y;
                       cout<<"The Answer is "<<Answer<<endl;

                        break;
                           }

                    case '3':
                             {
                               cout << "\nHow many numbers are you entering?\n";
                            cin >> NumbersAmount;

                             while (loopcount < NumbersAmount){
                               cout<<"Enter your number\n";
                               cin>>number;
                                Total1 = Total1 * number;
                                 loopcount = loopcount+1;

                             }
                              cout<<" Total is"<<Total1<<endl;

                              break;

                       }

                   case '4':
                             {
                         cout<<"Enter first number: ";
                          cin>>x;
                          cout<<"Enter an other number: ";
                           cin>>y;
                         if(x!=0)
                          {
                           Answer=x/y;
                             cout<<"The Answer is "<<Answer<<endl;


                          }
                                break;
                             }

                 }// end of inner switch
                 break;
           }// end of case 1 arithmetic operation

  case '2':
            {
       cout<<" Welcome to Trigonometric Functions\n\n";
             cout<<"1 ~ Sin function\n:";
             cout<<"2 ~ Cos function\n:";
             cout<<"3 ~ Tan function\n\n:";
             cout<<" Choose your function by typing in the associated number";
       choice2=getche();
       switch(choice2)
       {
       case '1':        {
        cout<<"Enter a angle: ";
        cin>>angle;

       Answer1=(sin(angle));
        cout<<"The answer is  "<<Answer1<<endl;

        break;
        }
       case '2':
        {
       cout<<" Enter a number: ";
       cin>>angle;
       Answer1=(cos(angle));
       cout<<"The answer is "<<Answer1<<endl;

         break;
        }
       case '3':
       {
       cout<< "Enter a number: ";
        cin>>angle;
          Answer1=(tan(angle));
         cout<<"The answer is "<<Answer1<<endl;

         break;
        }

      }// inner switch
       break;
            }//inner case 2 trignomatic
       case '3':
            {

       cout<<"\n1 ~ Natural log:";
       cout<<"\n2 ~Log with base 10:\n";
       choice3=getche();
       switch(choice3)
       {
      case '1':
        {
       cout<<" Enter a number: ";
        cin>>x1;
        Answer1=log(x1);
       cout<<"The answer is  "<<Answer1<<endl;

       break;
      }
      case '2':
        {
        cout<<"Enter a number: ";
        cin>>x1;
               Answer1= log10(x1);
        cout<<"The answer is "<<Answer1<<endl;

        break;
        }
              }// end of switch
          break;
            }// end of case 3 logrithmic
       case '4':
            {

       cout<<"\t ~  Press 1 for Power\n";
       cout<<"\t ~  Press 2 for Square root:\n";
       cout<<"\t ~  Press 3 for Square\n";
      cout<<"\t ~  Press 4 for Cube\n\n";
       cout<<"\tEnter your choice\n\n:";
       choice4=getche();
      switch(choice4)
       {
       case '1':
        {
        cout<<"      Enter a number: ";
         cin>>x1;
         cout<<"      Enter power: ";
         cin>>y1;         Answer1=pow(x1,y1);
         cout<<"The Answer is  "<<Answer1<<endl;

         break;
        }
       case '2':
        {
         cout<<"      Enter a number: ";
         cin>>x;
         Answer1=sqrt(x);
         cout<<"The Answer is "<<Answer1<<endl;

         break;

        }
        case '3':
          {
       cout<<"        Enter a number: ";
             cin>>x;
              Answer1= x*x;
              cout<<" The Answer is"<<Answer1<<endl;

  break;

  }
  case '4':
  {
  cout<<"             Enter a number: ";
  cin>>x;
  Answer1 =x*x*x;
 cout<<" The answer is"<<Answer1<<endl;
  break;
  }
       }//end switch
      break;
  }//end of case power function    }//outer switch
    }
    while (choice!='5');
  }
return 0 ;
} 

Last edited on
closed account (48T7M4Gy)
Didn't you get a line number with the error message? Or does your system expect you to be a mindreader?
The error line is 243
closed account (48T7M4Gy)
..
Last edited on
my apologies the brace is in my program , i just missed it out here.. will enter it in now... but my errors still remains on the last line
closed account (48T7M4Gy)
I just had a quick look at your code using the shell and also what you presneted here.

You have a series of stuff ups with braces etc and you will need to:
1. Properly present your code professionally especially using proper indentation.
2. Line 241 is rubbish that does nothing. Get rid of it.
3. Make sure all braces balance.

You're in for some fairly easy editing and debugging if you do that and if you understand the code you're using.
Last edited on
closed account (48T7M4Gy)
Multiple poster pest - music just stopped from me.

http://www.cplusplus.com/forum/general/180016/
Last edited on
Topic archived. No new replies allowed.