Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Problem C Type conversion in function calls 4.1 Specification Write an ANSI-C program that reads inputs from the user one integer, one floating point

image text in transcribed

4. Problem C Type conversion in function calls 4.1 Specification 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 arithmeti calculation based on the inputs 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 explici type conversion (casting) display before each input the following prompt: Enter operand_1 operator operand 2 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) 4.3 Sample Inputs/Outputs: (on the single line) red 329 % gcc -o lab3cov ab3 conversion, c red 330 % lab3Cov Enter operand_1 operator operand2 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 operand 2 separated by blanks 12 2.331 Your input '12 2.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 red 331 % Do you understand why the results of the fun-IF and fun-FF are same but both are different -1 from fun-11? Write your justification briefly on the program file (as comments) Assume all the inputs are valid

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions