This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: fscanf(fpin, "%d", &quarters); //get quarters from file /* Get and display customer's initials from in.txt file.*/ fscanf(fpin, "%c%c%c", &first, &middle, &last); fprintf(fpout, "Hello %c%c%c, let's see what your coins are worth.\n", first, middle, last); /*calculate total cents*/ total_cents = 25 * quarters + 10 * dimes + 5 * nickels + pennies; //seperate dollars from cents dollars = total_cents / 100; change = total_cents % 100; /*write calculated output to seperate out file*/ fprintf(fpout, "\nYour coins are worth %d dollars and %d cents. \n", dollars, change); fclose(fpin); //close in text file fclose(fpout); //close output text file return (0); }...
View Full Document
This note was uploaded on 08/06/2008 for the course EGR 261 taught by Professor Parikh during the Spring '08 term at Grand Valley State.
- Spring '08