Erin's CS stuff

CS stuff!

Formatted IO Quick Guide

Type Application Example Notes
stdio library library needed to interact with the user through the terminal window and keyboard This is a preprocessor directive which goes above the main (and under the header comments).
printf output text to the screen code in your program file:
terminal output when running the executable:
REMINDER!
You can use things like field width and precision to format how your output looks when displayed to the screen!
scanf get input from the keyboard code in your program file:
terminal output when running the executable:

FIRST the prompt displays and the program does nothing until the user has entered the right information
THEN the program continues execution after the user has hit the Enter key
  • only conversion specifiers go between the double quotes
    • unless we're trying to skip over blank space when saving a char value
      • see the space before the %c in the example
  • don't forget the & (ampersand) before each variable name
  • CAUTION!
    • nothing is ever displayed to the screen
      • trying to use formatting like field width and precision won't do anything