Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started