-1
#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;
}
ohh .. уточните синтаксис. –
Ваш код реализует только одну из 5 функций, определенных и вызываемых 'main'. Где 'int two_variable() {}' 'int three_variable() {}' 'int quadratic() {}' 'int trigonometric() {}'? – LPs
Попробуйте создать [*** Минимальный ***, полный и проверенный пример] (http://stackoverflow.com/help/mcve), чтобы показать нам. И пожалуйста [читайте о том, как задавать хорошие вопросы] (http://stackoverflow.com/help/how-to-ask). И включайте фактические ошибки, которые вы получаете, в полном объеме, полные и неотредактированные. –