Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please look over my program and tell me what I am going wrong? This is Programming in C and not C++.. ERROR MESSAGES:

Can someone please look over my program and tell me what I am going wrong? This is Programming in C and not C++..

ERROR MESSAGES:

1) syntax error: '&' 2) 'print' undefined; assuming extern returning int 3)unintialized local variable 'cup' used

QUESTION:

In the U.S. system of volume measurements, a pint is 2 cups, a cup is 8 ounces, an ounce is 2 tablespoons, and a tablespoon is 3 teaspoons. Write a program that requests a volume in cups and that displays the equivalent volumes in pints, ounces, tablespoons, and teaspoons. Why does a floating-point type make more sense for this application than an integer type?

MY PROGRAM ANSWER:

#include

int main(void)

{

float cup, pints, oz, tbs, tsp;

pint=cup/2; /*conversion cup to pint*/

oz=cup*8; /*conversion cup to ounce*/

tbs=oz*2; /*conversion ounce to tablespoon*/

tsp=tbs*3; /*conversion tablespoon to teaspoon*/

printf(Enter the volume in cups: );

scanf_s(%f, &cup);

printf(Equivalent volume in pints is: %f. , pint);

printf(Equivalent volume in ounces is: %f. , oz);

printf(Equivalent volume in tablespoons is: %f. , tbs);

printf(Equivalent volume in teaspoons is: %f. , tsp);

return 0;

}

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

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

d. How will lack of trust be handled?

Answered: 1 week ago