error: expected '(' before numeric constant|



#include<iostream>
#include<cmath>
#include<cstdlib>
#include<conio.h>
using namespace std;
int main ()
{
int loopcount=0;
int total=0;
char choice, choice1, choice2, choice3, choice4;
int Answer,x,y;
int NumbersAmount;
int number;
double x1,y1;
double Answer1;
double angle;
cout<<" Welcome to TwoSixEight Geeka Scientific Calculator\n";
cout << " Coded by Jenell Joanne James\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:";
choice = getche();
if(choice==5);
break;

switch(choice)

{
case '1':

{
cout<< " \n\n Welcome to the Arithmetic Operations\n";
cout<<" Enter the number of the operator you will like to select\n";
cout<<"\t1 : Addition \n: ";
cout<<"\t2 : subtraction \n: ";
cout<<"\t3 : Multipilication \n: ";
cout<<"\t4 : Division \n: ";
choice1 = getche();

switch(choice1)
{
case '1':
{
cout << "How many numbers are you entering today?\n";
cin >> NumbersAmount;

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

}
cout<<" Total is "<<total<<endl;
system ("pause");
break;
system("cls");
}
case '2':
{
cout<<"Enter first number: ";
cin>>x;
cout<<"Enter an other number: ";
cin>>y;
Answer=x-y;
cout<<"The Answer is "<<Answer<<endl;
system("pause");
break;
}

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

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

}
cout<<" Total is"<<total<<endl;
system ("pause");
break;
system("cls");

}

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;
system("pause");
}
break;
}

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

case '2':
{

cout<<"\t1 : Sin function \n: ";
cout<<"\t2 : Cos function \n: ";
cout<<"\t3 : Tan function \n: ";
choice2=getche();
switch(choice2)
{
case '1':
{
cout<<"Enter a angle: ";
cin>>angle;

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

}

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

cout<<"\t1 : Natural log \n: ";
cout<<"\t2 : 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;
system("pause");
break;
}
case '2':
{
cout<<"Enter a number: ";
cin>>x1;
Answer1= log10(x1);
cout<<"The answer is "<<Answer1<<endl;
system("pause");
break;
}
}// end of switch
break;
}// end of case 3 logrithmic
case '4':
{
system("cls");
cout<<"1 ~ Press 1 for Power:\n";
cout<<"2 ~ Press 2 for Square root:\n";
cout<<"3 ~ Press 3 for square:\n";
cout<<"4 ~ Press 4 for cube:\n";
cout<<"Enter your choice:\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;
system("pause");
break;
}
case '2':
{
cout<<"Enter a number: ";
cin>>x;
Answer1=sqrt(x);
cout<<"answer is "<<Answer1<<endl;
system("pause");
break;

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

}
case '4':
{
cout<<" Enter a number: ";
cin>>x;
Answer1 =x*x*x;
cout<<" The answer is"<<Answer1<<endl;
system("pause");
break;
}
}//end switch
break;
}//end case power function

}//end outter switch
while (choice !='5');

return 0;

}
Last edited on
http://www.cplusplus.com/articles/z13hAqkS/


Please always use code tags If you do this, we can compile it here with the gear icon top right of the code, we can have line numbers, some indentation if you had it, keyword highlighting. You may also get more replies.

If you have compile errors then post them here verbatim, not in part nor your interpretation of them. Make sure the line numbers match the code in code tags.

Ask a question, 7 words isn't sufficient.
am new to this not sure how to use code tags here
Topic archived. No new replies allowed.