@@ -7,54 +7,52 @@ \section{IO}
7
7
\item a sequence of characters divided into lines
8
8
\item each line consists of $ \ge 0 $ characters followed by a newline character
9
9
\end {itemize }
10
+
11
+ \vspace {0.80cm}
12
+ \centerline {\texttt {\# include <stdio.h> }}
10
13
\end {frame }
11
14
% %%%%%%%%%%%%%%
12
15
13
16
% %%%%%%%%%%%%%%
14
- \begin {frame }{Standard Input and Output: 以 \texttt {getchar }, \texttt {putchar } 为例}
15
- \centerline {代码示例: \texttt {file-copy.c }}
17
+ \begin {frame }{字符输入输出: \texttt {getchar }, \texttt {putchar }}
18
+ \begin {center }
19
+ \href {http://www.cplusplus.com/reference/cstdio/getchar/}{\texttt {int \blue {getchar}(void); }} \\ [8pt]
20
+ \href {http://www.cplusplus.com/reference/cstdio/putchar/}{\texttt {int \blue {putchar}(int character); }}
21
+ \end {center }
16
22
17
23
\vspace {0.50cm}
18
- \pause
19
- \href {http://www.cplusplus.com/reference/cstdio/EOF/}{EOF} (文件结束符):由宏定义的整型数
20
- \begin {itemize }
21
- \item EOF 是整型数 (\texttt {int c }; \texttt {!= EOF })
22
- \item EOF 不是实际字符, 不同于行结束符 `` \texttt {\textbackslash n }'' (\texttt {== '\textbackslash n' })
23
- \item EOF 不单单指示`` 文件'' 的结束, 而是指示字符流的结束
24
- \end {itemize }
24
+ \centerline {代码示例: \texttt {file-copy.c }}
25
25
26
26
\pause
27
27
\vspace {0.50cm}
28
- \centerline {代码运行:\texttt {./file-copy }}
28
+ \centerline {代码运行:\texttt {gcc file-copy.c -o file-copy \;\; ./file-copy }}
29
29
30
30
\pause
31
- \vspace {0.30cm}
32
- \begin {columns }[c]
33
- \column {0.45\textwidth }
34
- \begin {description }[Windows]
35
- \item [Windows] \texttt {Ctrl + Z }
36
- \item [Linux] \texttt {Ctrl + D }
37
- \item [Mac] \texttt {Ctrl + D }
38
- \end {description }
39
- \column {0.45\textwidth }
40
- 请仔细观察并思考:
41
- \begin {enumerate }
42
- \item \texttt {Enter } 的作用
43
- \item EOF 的作用
44
- \end {enumerate }
45
- \end {columns }
31
+ \vspace {0.80cm}
32
+ \centerline {代码运行:\texttt {./file-copy <file-copy-file } (OJ 测试用例)}
46
33
\end {frame }
47
34
% %%%%%%%%%%%%%%
48
35
49
36
% %%%%%%%%%%%%%%
50
- \begin {frame }{IO on OJ: input redirection (输入重定向)}
51
- \centerline {代码运行:\texttt {./file-copy <file-copy-file }}
37
+ \begin {frame }{EOF}
38
+ \href {http://www.cplusplus.com/reference/cstdio/EOF/}{EOF} (文件结束符):由宏定义的整型数
39
+ \begin {itemize }
40
+ \item EOF 是整型数 (\texttt {int c }; \texttt {!= EOF })
41
+ \item EOF 不是实际字符, 不同于行结束符 `` \texttt {\textbackslash n }'' (\texttt {== '\textbackslash n' })
42
+ \item EOF 不单单指示`` 文件'' 的结束, 而是指示字符流的结束
43
+ \end {itemize }
44
+
45
+ \begin {description }[Windows]
46
+ \item [Windows] \texttt {Ctrl + Z }
47
+ \item [Linux] \texttt {Ctrl + D }
48
+ \item [Mac] \texttt {Ctrl + D }
49
+ \end {description }
52
50
\end {frame }
53
51
% %%%%%%%%%%%%%%
54
52
55
53
% %%%%%%%%%%%%%%
56
54
\begin {frame }{格式化输出:\texttt {printf }}
57
- \centerline {\href {http://www.cplusplus.com/reference/cstdio/printf/}{\texttt {int printf(const char* format, ...); }}}
55
+ \centerline {\href {http://www.cplusplus.com/reference/cstdio/printf/}{\texttt {int \blue { printf} (const char* format, ...); }}}
58
56
59
57
\vspace {0.50cm}
60
58
\centerline {format: \texttt {\% [flags][width][.precision][length]specifier }}
@@ -80,21 +78,21 @@ \section{IO}
80
78
% %%%%%%%%%%%%%%
81
79
82
80
% %%%%%%%%%%%%%%
83
- \begin {frame }{其它输出函数 :\texttt {fprintf }, \texttt {sprintf }}
81
+ \begin {frame }{其它格式化输出函数 :\texttt {fprintf }, \texttt {sprintf }}
84
82
\begin {center }
85
83
\href {http://www.cplusplus.com/reference/cstdio/fprintf/}
86
- {\texttt {int fprintf(FILE *stream, const char *format, ...); }} \\ [0.50cm]
84
+ {\texttt {int \blue { fprintf} (FILE *stream, const char *format, ...); }} \\ [0.50cm]
87
85
88
86
\href {http://www.cplusplus.com/reference/cstdio/sprintf/}
89
- {\texttt {int sprintf(char *str, const char *format, ...); }}
87
+ {\texttt {int \blue { sprintf} (char *str, const char *format, ...); }}
90
88
\end {center }
91
89
\end {frame }
92
90
% %%%%%%%%%%%%%%
93
91
94
92
% %%%%%%%%%%%%%%
95
93
\begin {frame }{格式化输入:\texttt {scanf }}
96
94
\centerline {\href {http://www.cplusplus.com/reference/cstdio/scanf/}
97
- {\texttt {int scanf(const char *format, ...) }}}
95
+ {\texttt {int \blue { scanf} (const char *format, ...) }}}
98
96
99
97
\vspace {0.30cm}
100
98
\begin {enumerate }
@@ -134,27 +132,27 @@ \section{IO}
134
132
% %%%%%%%%%%%%%%
135
133
136
134
% %%%%%%%%%%%%%%
137
- \begin {frame }{其它输入函数 : \texttt {fscanf }, \texttt {sscanf }}
135
+ \begin {frame }{其它格式化输入函数 : \texttt {fscanf }, \texttt {sscanf }}
138
136
\begin {center }
139
137
\href {http://www.cplusplus.com/reference/cstdio/fscanf/}
140
- {\texttt {int fscanf(FILE *stream, const char *format, ...); }} \\ [0.50cm]
138
+ {\texttt {int \blue { fscanf} (FILE *stream, const char *format, ...); }} \\ [0.50cm]
141
139
142
140
\href {http://www.cplusplus.com/reference/cstdio/sscanf/}
143
- {\texttt {int sscanf(const char *s, const char *format, ...); }}
141
+ {\texttt {int \blue { sscanf} (const char *s, const char *format, ...); }}
144
142
\end {center }
145
143
\end {frame }
146
144
% %%%%%%%%%%%%%%
147
145
148
146
% %%%%%%%%%%%%%%
149
- \begin {frame }{Line Input and Output }
147
+ \begin {frame }{行输入输出 }
150
148
\begin {center }
151
149
\href {http://www.cplusplus.com/reference/cstdio/fgets/}
152
- {\texttt {char *fgets(char *str, int num, FILE *stream); }} \\ [0.30cm]
150
+ {\texttt {char *\blue { fgets} (char *str, int num, FILE *stream); }} \\ [0.30cm]
153
151
154
- \href {http://www.cplusplus.com/reference/cstdio/gets/}{\texttt {char *gets(char *str); }} \\ [0.50cm]
152
+ \href {http://www.cplusplus.com/reference/cstdio/gets/}{\texttt {\textcolor {gray}{ char *gets(char *str);} }} \\ [0.50cm]
155
153
156
154
\href {http://www.cplusplus.com/reference/cstdio/puts/}
157
- {\texttt {int puts(const char *str); }}
155
+ {\texttt {int \blue { puts} (const char *str); }}
158
156
\end {center }
159
157
\end {frame }
160
158
% %%%%%%%%%%%%%%
0 commit comments