CSC161 2010F Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Back to Types and Operators. On to Input and Output, Continued.
This outline is also available in PDF.
Held: Tuesday, 7 September 2010
Summary: We consider in some detail input and output in C.
Related Pages:
Notes:
Overview:
We typically print using printf
printf
is a format string
that indicates how to present the remaining parameters.
%
is
an indication to insert the next of the remaining parameters.
%d
- an integer (decimal)
%5d
- an integer, using at least 5 spaces
%f
- a double
%.2f
- a double, with two decimal places after the decmial
%s
- a string
We typically read using scanf
scanf
is also a format string.
&
scanf ("%d", &i);
scanf("%1d%1d%1d", &x1, &x2, &x3);
We can also read using getchar
and write using
putchar
.
Back to Types and Operators. On to Input and Output, Continued.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
-
[Assignment]
[Lab]
Groupings:
[EBoards]
[Assignments]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:57:02 2010.
The source to the document was last modified on Fri Aug 13 15:41:46 2010.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2010F/Outlines/outline.07.html
.