Define a function AdjustState() that takes one integer parameter as the water temperature and one character parameter pa

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Define a function AdjustState() that takes one integer parameter as the water temperature and one character parameter pa

Post by answerhappygod »

Define a function AdjustState() that takes one integer parameteras the water temperature and one character parameter passed bypointer as the water's state ('L' means liquid, 'B' means boiling,and 'G' means gas). The function updates the state with:
Ex: If the input is 104, then the output is:
Water state is changed to G.
#include <stdio.h>#include <stdbool.h>/* Your code goes here */
int main(void) { int waterTemperature; char waterState; bool isChanged;
waterState = 'B'; scanf("%d", &waterTemperature);
isChanged = AdjustState(waterTemperature,&waterState);
if (isChanged) { printf("Water state is changed to %c.\n",waterState); } else { printf("Water state %c is not changed.\n",waterState); }
return 0;}
in c please
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply