I made this code and i dont know what to do with my warning in calling function calc() inside the function getOption(). What should i do? need some little help here.
#include<stdio.h>
void getOption();
void getData(int *num1, int *num2);
void calc(int option, int num1, int num2);
float add(int num1, int num2);
float sub(int num1, int num2);
float mul(int num1, int num2);
float div(int num1, int num2);
void printResult(float result);
int main()
{
clrscr();
getOption();
getch();
}
void getOption()
{
int option,num1,num2;
clrscr();
printf("[1] Addition\n");
printf("[2] Subtraction\n");
printf("[3] Multiplication\n");
printf("[4] Division\n");
printf("\nChoose options: ");
scanf("%d", &option);
calc(option,num1,num2);
}
void getData(int *num1, int *num2)
{
printf("Enter two integers: ");
scanf("%d %d", num1, num2);
}
void calc(int option, int num1, int num2)
{
switch(option)
{
case 1: clrscr();
printf("\"ADDITION\"\n");
getData(&num1,&num2);
printResult(add(num1,num2));
break;
case 2: clrscr();
printf("\"SUBTRACTION\"\n");
getData(&num1,&num2);
printResult(sub(num1,num2));
break;
case 3: clrscr();
printf("\"MULTIPLICATION\"\n");
getData(&num1,&num2);
printResult(mul(num1,num2));
break;
case 4: clrscr();
printf("\"DIVISION\"\n");
getData(&num1,&num2);
printResult(div(num1,num2));
break;
default: printf("Invalid key");
}
main();
}
float add(int num1, int num2)
{
int add;
add=num1+num2;
return add;
}
float sub(int num1, int num2)
{
int sub;
sub=num1-num2;
return sub;
}
float mul(int num1, int num2)
{
int mul;
mul=num1*num2;
return mul;
}
float div(int num1, int num2)
{
int div;
div=num1/num2;
return div;
}
void printResult(float result)
{
printf("The result is: %.2f", result);
getch();
}