1. Engineering
  2. Computer Science
  3. sample output...

Question: sample output...

Question details

Write an ANSI-C program that reads inputs from the user one integer, one floating point number, and a character operator. The program does a simple calculation based on the two input numbers and the operator. The program continues until both input integer and floating point number are-1. 4.2 Implementation name the program lab3conversion.c use scanf to read inputs (from Standard input), each of which contains an integer, a character ( + , - * or . / .) and a floating point number (defined as float) separated by blanks. Use printf to generate outputs representing the operation results define a function float fun IF (int, char, float) which conducts arithmetic calculation based on the inputs e define another function float fun_II (int, char, int) which conducts arithmetic calculation based on the inputs . define another function float fun FF (float, char, float) which conducts arithmetic calculation based on the inputs note that these three functions should have the same code in the body. They only differ in the arguments type and return type pass the integer and the float number to both the three functions directly, without explicit type conversion (casting) display before each input the following prompt Enter operand 1 operator operand2 separated by blanks> display the outputs as follows (on the same line. One blank between each words) Your input x xx xxx results in xxxx (fun IF) and xxxxx (fun II) and xxxxxx (fun FF)

Sample Output:

Enter operand_1 operator operand 2 separated by blanks 12 22.3024 Your input 12 22.302401 result in 34.302399 (fun_IF) and 34.000000 (fun_II) and 34.302399 (fun_FF) Enter operand_1 operator operand2 separated by blanks>12 2.331 Your input 122.331000 result in 27.972000 (fun_IF) and 24.000000 (fun_II) and 27.972000 (fun_FF) Enter operand 1 operator operand 2 separated by blanks>2 9.18 Your input 2/ 9.180000 result in 0.217865 (fun_IF) and 0.000000 (fun_II) and 0.217865 (fun_FF) Enter operand 1 operator operand 2 separated by blanks>-1-1 red 331 %

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution