September 1998
Intermediate to advanced
848 pages
20h 13m
English
Once again, you begin with a sample program. As before, you'll find some unfamiliar wrinkles that we'll soon iron out for you. The program's general intent should be clear, so try compiling and running the source code shown in Listing 3.1. To save time, you can omit typing the comments.
/* goldyou.c -- the worth of your weight in gold */ #include <stdio.h> int main(void) { float weight; /* user weight */ float value; /* user's gold equivalent */ printf("Are you worth your weight in gold?\n"); printf("Let's check it out.\n"); printf("Please enter your weight in pounds: "); /* get input from the user */ scanf("%f", &weight); /* assume gold is $320 per ounce */ /* 14.5833 converts pounds avd. ... |
Read now
Unlock full access