October 21st, 2012, 03:32 AM
I'm still new to C programming
i tried many times but the result still can't same as the question want.
the question is , make a calculator with the function of operators + - * / ^ and it require the use of selection and looping statement. The program will allow the operation of the operator functions more than once, and it will quit when recieves the character 'q' or 'Q'. the program then displays the last result for the calculation.
someone can show me which part was incorrect? Thank :)
void scan_data(char *op1p, double *num1p);
void do_next_op(char op1, double num1, double *accum);
printf("Hit enter to turn the calculator on");
do_next_op(op1, num1, &accum);
(!(op1 == 'q'));
void scan_data(char *op1p, double *num1p)
printf("\nEnter an operator [^,*,/,+,-,q (quit): ");
printf("\nEnter a number to calculate for: ");
printf("The result so far is %c %f \n", &op1p, &num1p);
October 21st, 2012, 04:09 AM
It will be better if you explained where you think it fails. Are there any errors? unexpected behaviour?
How do you see the program should work from user point of view?
You call a function do_next_op, but you haven't include it in the posted code.
October 21st, 2012, 04:43 AM