i have to create a calculator which i have but i cant get it to run yet. i keep getting "12: error: subscripted value is neither array nor pointer" i'll highlight it for you. if anyone can fix it please do thank you.
#include<math.h>
#include<stdio.h>
int main()
{
float num1,num2,answer,i;
char c, menu;
display_menu ();
{
int i;
for (i=0; i<=4;i++)
[B]printf("%s\n",menu [i]);[/B]
}
char menu_item[7][14]={"Adition","Subtraction","Multiplcation","division","squareroot","percentage","Quit"};
get_input();
{
char c;
while (1)
{
display_menu();
printf("enter command\n");
c=getch();
switch (c)
{
case 'A':
case'a': Addition();
printf("enter two numbers:\n");
scanf("%f",&num1);
scanf("%f",&num2);
answer=num1+num2;
break;
case'S':
case's': Subtraction();
printf("Enter two numbers to subtract:\n");
scanf("%f",&num1);
scanf("%f",&num2);
if (num1>num2) {
answer=num1-num2;
}
else if (num1<num2){
answer=num2-num1;
}
break;
case'M':
case'm': Multiplication();
printf("enter two numbers to multiply:\n");
scanf("%f",&num1);
scanf("%f",&num2);
answer=num1*num2;
break;
case'D':
case'd': Division();
printf("enter");
scanf("%f",&num1);
scanf("%f",&num2);
answer=num1/num2;
break;
case'R':
case'r': Squareroot();
printf("enter number to be square rooted:\n");
scanf("%f",&num1);
answer = sqrt(num1);
break;
case'P':
case'p': Percentage();
printf("Enter first number to be the percent and the second number to be\n");
scanf("%f",&num1);
scanf("%f",&num2);
answer = num1*num2/100;
break;
case'Q':
case'q': return;
}
printf("Answer is %f\n",answer);
}
}
}