Finished report
BIN
assets/printf-formats/main-p1-f.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
assets/printf-formats/main-p1-lf.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/printf-formats/main-p2-d.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
assets/printf-formats/main-p2-lf.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/printf-formats/main-s1-f.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
assets/printf-formats/main-s1-lf.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
assets/printf-formats/main-s2-d.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
assets/printf-formats/main-s2-f.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
@@ -30,9 +30,11 @@ page_config:
|
|||||||
# - pkgs
|
# - pkgs
|
||||||
|
|
||||||
sections:
|
sections:
|
||||||
- { path: 'section/introduction.tex', newpg: true }
|
- { path: 'section/introduction.tex', newpg: false }
|
||||||
|
- { path: 'section/syntax.tex', newpg: true }
|
||||||
- { path: 'section/prog1.tex', newpg: true }
|
- { path: 'section/prog1.tex', newpg: true }
|
||||||
- { path: 'section/prog2.tex', newpg: true }
|
- { path: 'section/prog2.tex', newpg: true }
|
||||||
- { path: 'section/lst22.tex', newpg: true }
|
- { path: 'section/lst22.tex', newpg: true }
|
||||||
- { path: 'section/rev3dig.tex', newpg: true }
|
- { path: 'section/rev3dig.tex', newpg: true }
|
||||||
|
- { path: 'section/printf-formats.tex', newpg: false }
|
||||||
|
|
||||||
|
|||||||
6
main.tex
@@ -11,6 +11,8 @@
|
|||||||
\subject{情報処理I}
|
\subject{情報処理I}
|
||||||
\professor{岡崎 憲一教員}
|
\professor{岡崎 憲一教員}
|
||||||
|
|
||||||
|
\usepackage[table,xcdraw]{xcolor}
|
||||||
|
|
||||||
\pagenumbering{roman}
|
\pagenumbering{roman}
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
@@ -21,6 +23,8 @@
|
|||||||
\pagenumbering{arabic}
|
\pagenumbering{arabic}
|
||||||
|
|
||||||
\input{section/introduction.tex}
|
\input{section/introduction.tex}
|
||||||
|
|
||||||
|
\input{section/syntax.tex}
|
||||||
\newpage
|
\newpage
|
||||||
|
|
||||||
\input{section/prog1.tex}
|
\input{section/prog1.tex}
|
||||||
@@ -35,6 +39,8 @@
|
|||||||
\input{section/rev3dig.tex}
|
\input{section/rev3dig.tex}
|
||||||
\newpage
|
\newpage
|
||||||
|
|
||||||
|
\input{section/printf-formats.tex}
|
||||||
|
|
||||||
\printbibliography[heading=bibintoc,title={参考文献}]
|
\printbibliography[heading=bibintoc,title={参考文献}]
|
||||||
|
|
||||||
\compiledTime
|
\compiledTime
|
||||||
|
|||||||
BIN
output/main.pdf
@@ -7,6 +7,7 @@
|
|||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item OS: Arch Linux
|
\item OS: Arch Linux
|
||||||
\item CPU アーキテクチャ: \texttt{x86\_64}
|
\item CPU アーキテクチャ: \texttt{x86\_64}
|
||||||
\item C コンパイラ: \texttt{gcc バージョン 14.2.1 20250322 (GCC)}
|
\item C コンパイラ(5月1日付): \texttt{gcc バージョン 14.2.1 20250322 (GCC)}
|
||||||
|
\item C コンパイラ(5月4日付): \texttt{gcc バージョン 15.1.1 20250425 (GCC)}
|
||||||
\item C コンパイラオプション: \texttt{-Wall <ソースコード名> -o <プログラム名>}
|
\item C コンパイラオプション: \texttt{-Wall <ソースコード名> -o <プログラム名>}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|||||||
@@ -1,65 +1,97 @@
|
|||||||
\section{\texttt{double}型と\texttt{printf}関数・\texttt{scanf}関数の書式}
|
\section{\texttt{int}型・\texttt{double}型と\texttt{printf}関数・\texttt{scanf}関数の書式}
|
||||||
|
|
||||||
\defaultlistingstyle
|
\defaultlistingstyle
|
||||||
\lstinputlisting[language=C, title={変更元のソースコード}]{../programs/printf-formats/main.c}
|
\lstinputlisting[language=C, title={変更前のソースコード}]{../programs/printf-formats/main.c}
|
||||||
|
|
||||||
上記のソースコードについて、\texttt{printf}関数と\texttt{scanf}関数の書式を次のように変更していく:
|
上記のソースコードについて、\texttt{printf}関数と\texttt{scanf}関数の書式を次のように変更していく:
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{table}[h]
|
||||||
\item 第一の\texttt{printf}関数の書式を\texttt{\%f}にする
|
\centering
|
||||||
\item 第一の\texttt{printf}関数の書式を\texttt{\%lf}にする
|
\begin{tabular}{lc}
|
||||||
\item 第二の\texttt{printf}関数の書式を\texttt{\%d}にする
|
\hline
|
||||||
\item 第二の\texttt{printf}関数の書式を\texttt{\%lf}にする
|
\multicolumn{1}{c}{概要} & 実行ファイル名 \\
|
||||||
\item 第一の\texttt{scanf}関数の書式を\texttt{\%f}にする
|
\hline \hline
|
||||||
\item 第一の\texttt{scanf}関数の書式を\texttt{\%lf}にする
|
第一の\texttt{printf}関数の書式を\texttt{\%f}にする & \texttt{main-p1-f} \\
|
||||||
\item 第二の\texttt{scanf}関数の書式を\texttt{\%d}にする
|
第一の\texttt{printf}関数の書式を\texttt{\%lf}にする & \texttt{main-p1-lf} \\
|
||||||
\item 第二の\texttt{scanf}関数の書式を\texttt{\%f}にする
|
第二の\texttt{printf}関数の書式を\texttt{\%d}にする & \texttt{main-p2-d} \\
|
||||||
\end{itemize}
|
第二の\texttt{printf}関数の書式を\texttt{\%lf}にする & \texttt{main-p2-lf} \\
|
||||||
|
第一の\texttt{scanf}関数の書式を\texttt{\%f}にする & \texttt{main-s1-f} \\
|
||||||
|
第一の\texttt{scanf}関数の書式を\texttt{\%lf}にする & \texttt{main-s1-lf} \\
|
||||||
|
第二の\texttt{scanf}関数の書式を\texttt{\%d}にする & \texttt{main-s2-d} \\
|
||||||
|
第二の\texttt{scanf}関数の書式を\texttt{\%f}にする & \texttt{main-s2-f} \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{table}
|
||||||
|
|
||||||
\subsection{\texttt{main-p1-f}}
|
\subsection{\texttt{main-p1-f}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p1-f}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p1-f.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-p1-lf}}
|
\subsection{\texttt{main-p1-lf}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p1-lf}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p1-lf.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-p2-d}}
|
\subsection{\texttt{main-p2-d}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p2-d}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p2-d.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-p2-lf}}
|
\subsection{\texttt{main-p2-lf}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p2-lf}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p2-lf.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-s1-f}}
|
\subsection{\texttt{main-s1-f}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p3-f}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s1-f.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-s1-lf}}
|
\subsection{\texttt{main-s1-lf}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p3-lf}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s1-lf.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-s2-d}}
|
\subsection{\texttt{main-s2-d}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p4-d}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s2-d.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\subsection{\texttt{main-s2-f}}
|
\subsection{\texttt{main-s2-f}}
|
||||||
|
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p4-f}
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s2-f.png}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\subsection{結果}
|
||||||
|
|
||||||
|
\begin{table}[h]
|
||||||
|
\caption{実行結果一覧(強調行は正常結果)}
|
||||||
|
\centering
|
||||||
|
\begin{tabular}{|ccc|}
|
||||||
|
\hline
|
||||||
|
実行ファイル名 & コンパイル警告の有無 & 意図的な結果であるか \\
|
||||||
|
\hline \hline
|
||||||
|
\texttt{main-p1-f} & 有 & 否 \\
|
||||||
|
\rowcolor[HTML]{FFC702}
|
||||||
|
\texttt{main-p1-lf} & 無 & 然 \\
|
||||||
|
\texttt{main-p2-d} & 有 & 否 \\
|
||||||
|
\rowcolor[HTML]{FFC702}
|
||||||
|
\texttt{main-p2-lf} & 無 & 然 \\
|
||||||
|
\texttt{main-s1-f} & 有 & 否 \\
|
||||||
|
\texttt{main-s1-lf} & 有 & 否 \\
|
||||||
|
\texttt{main-s2-d} & 有 & 否 \\
|
||||||
|
\texttt{main-s2-f} & 有 & 否 \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{table}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
\section{今回の構文}
|
||||||
|
|
||||||
|
\subsection{四則演算}
|
||||||
|
|
||||||
|
C言語での四則演算は以下の通りである:
|
||||||
|
|
||||||
|
\defaultlistingstyle
|
||||||
|
\begin{lstlisting}[language=C, title={四則演算}]
|
||||||
|
a + b; // 加算
|
||||||
|
a - b; // 減算
|
||||||
|
a * b; // 乗算
|
||||||
|
a / b; // 除算 a、b共に整数型だと演算結果は小数点以下切り捨てられた値となる
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
\subsection{剰余演算}
|
||||||
|
|
||||||
|
aをbで割った余りを求める剰余演算は以下の通りである:
|
||||||
|
|
||||||
|
\defaultlistingstyle
|
||||||
|
\begin{lstlisting}[language=C, title={剰余演算}]
|
||||||
|
a % b; // 剰余
|
||||||
|
\end{lstlisting}
|
||||||
|
|||||||