New to C and am attempting to make a Calculator for a homework assignment. However, I am running into some problems
So far I have only attempting testing the add option but am still coming up with an Input/Output error when attempting to do so.
I am attempting to make a calculator that looks something like this:
Enter Number One:
Enter Number Two:
1-Add
2-Subtract
3-Multiply
4-Divide
5-Mod
Enter your choice:
Result=
int choice, result;
float x,y ;
int main() {
printf("Enter Number One:",&x);
scanf("%f",&x);
printf("Enter Number Two:",&y);
scanf("%f",&y);
printf("1-Add\n2-Subtract\n3-Multiply\n4-Divide\n5-Mod\n");
printf("Enter your choice:",&choice);
scanf("%d",&choice);
if (choice==1) {
result=x+y;
printf("Result=\n%f+%f=%f",x,y,result);
}
}
Enter Number One:1
Enter Number Two:2
1-Add
2-Subtract
3-Multiply
4-Divide
5-Mod
Enter your choice:1
Result=
0.000000+0.000000=0.000000read from master failed
: Input/output error
RUN FAILED (exit value 1, total time: 1s)