Ok, I added another printf and scanf to exit. Here's what I've got:
Code:
/* goldyou.c -- the worth of your weight in gold */
#include <stdio.h>
int main(void)
{
float weight; /*users weight*/
float value; /*user's gold equivalent*/
float exit; /*exit program*/
printf("Are you worth your weight in gold?\n");
printf("Let's find out.\n");
printf("Please enter your weight in pounds: ");
/* get input from user */
scanf("%f", &weight);
/* gold is worth $320 per ounce */
/* 14.5833 converts pounds to ounces */
value = 320.0 * weight * 14.5833;
printf("Your weight in gold is worth $%.2f.\n", value);
printf("You are easily worth that!\n");
printf("If gold prices drop, eat more to maintain your value.\n");
printf("Please press enter to exit program: ");
scanf("%f", &exit);
return 0;
}
Now it will run the entire program but when you press enter to exit it will not exit. How can I do this?
-Fool