Created
December 29, 2016 22:42
-
-
Save s3f/7c23cd0e070234e7639cfd89936e06a8 to your computer and use it in GitHub Desktop.
Chapter 4 - Outputting Your Programs created by s3f - https://repl.it/E8AV/1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First example program | |
/* #include <stdio.h> (REMEMBER: remove comment signs to run first program!) | |
main() | |
{ | |
printf("Column A\tColumn B\tColumn C"); | |
printf("\nMy Computer\'s Beep Sounds Like This: \a!\n"); | |
printf("\"Lets fix that typo and then show the backslash "); | |
printf("character \\\" She said\n"); | |
return 0; | |
} | |
*/ | |
/* list of conversion characters and their descriptions: | |
%d --- integer | |
%f --- floating-point | |
%c --- character | |
%s --- string | |
*/ | |
// Second Example Program | |
#include <stdio.h> | |
main() | |
{ | |
printf("Quantity\tCost\tTotal\n"); | |
printf("%d\t\t$%.2f\n", 3, 9.99, 29.97); | |
printf("Too many spaces \b\b\b\b can be fixed with the "); | |
printf("\\%c Escape character\n", 'b'); | |
printf("\n\a\n\a\n\a\n\aSkip a few lines, and beep "); | |
printf("a few beeps.\n\n\n"); | |
printf("%s %c.", "You are kicking butt learning", 'C'); | |
printf("You just finished chapter %d.\nYou have finished ", 4); | |
printf("%.1f%c of the book.\n", 12.500, '%'); | |
printf("\n\nOne third equals %.2f or ", 0.333333); | |
printf("%.3f or %.4f or ", 0.333333, 0.333333); | |
printf("%.5f or %.6f\n\n\n", 0.333333, 0.3333333); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment