Im a freshman in college and new to programming entirely. I have to write a short program where the user inputs two operands, inputs a specific precision (say to 4 decimals points), then inputs an operator, such as /, +, or *. The expression is then calculated.
#include <stdio.h>
int main(int argc, const char * argv[]) {
int precision;
double a, b;
printf("Please enter desired precision");
scanf("%d", &precision);
printf("Please enter desired operands");
scanf("%lf %lf", &a, &b);
printf("%.*lf %.*lf", precision, a, precision, b);
printf("Please enter an expression\n");
return 0;
}
This is what I have thus far. Not sure how to get the user to input an operator without getting an error.