#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int arithmetic();
int two_variable();
int three_variable();
int quadratic();
int trigonometric();
//declaring all the main functions
int main(void){
char j;
int select;
printf("Enter mode\n 1. Arithmetic \t 2.Trigonometric \n 3.Quadratic\t 4.Two Variable\n \t 5.Three Variable \n");
scanf("%d",&select);
switch(select){
case 1: ; arithmetic(); break;
case 2: ; trigonometric();break;
case 3: ; quadratic(); break;
case 4: ; two_variable();break;
case 5: ; three_variable();break;
default: printf("ERROR");
}
printf("Continue? y/n");
scanf("%c",j);
if(j == 'y'){
int main();
}
return 0;
}
int arithmetic(){
int temp1,i,a,n,c = 0; //c is for count the no. of times function was called
float num[n];
float ans = 0;
printf("enter number of inputs:\0.2t");
scanf("%d",&n);
printf("enter numbers");
for(i=0;i<=n;i++){
scanf("%f",&num[i]);
}
printf(" 1.+ \t 2.- \n 3.* \t 4./t /n 5.^ /t 6.log ");
scanf("%d",a);
switch(a){
case 1://addition
for(i=0;i<n;i++){
ans += num[i];
}
break;
case 2://subtraction
for(i=0;i<n;i++){
ans -= num[i];
}
break;
case 3://multiplication
for(i=0;i<n;i++){
ans = 1;
ans *= num[i];
}
break;
case 4://division
ans = 1;
for(i=0;i<n;i++){
ans = ans/num[i];
}
break;
case 5: //power
ans = pow(num[0],num[1]);
break;
case 6 : //log
if(c>1){
ans = log(temp1); }
else{
ans = log(num[0]); }
break;
default :printf("ERROR");
}
temp1 == ans;
printf("ans = %f",ans);
char j;
printf("Continue? y/n");
scanf("%c",j);
if(j == 'y'){
int arithmetic();
}
return 0;
}
答案 0 :(得分:1)
您正在使用程序中的以下功能
arithmetic();
trigonometric();
quadratic();
two_variable();
three_variable()
但是你实现的只是arithmetic()函数而不是其他函数。实施这些并且错误将消失。