generated from kenryuS/report-temp
99 lines
2.7 KiB
TeX
99 lines
2.7 KiB
TeX
\documentclass[xelatex,a4paper,11pt,ja=standard]{bxjsarticle}
|
|
|
|
\usepackage{tex/preamble}
|
|
\usepackage{tex/simple-title}
|
|
|
|
\reportauthor{柴田健琉}
|
|
\reporttitle{情報処理2 - 前期第4回課題}
|
|
\reportdate{2026年}{05月}{11日}
|
|
\turnindate{2026年}{05月}{12日}
|
|
|
|
\begin{document}
|
|
\simpletitle{}
|
|
|
|
\section{はじめに}
|
|
|
|
この課題のプログラムは以下の環境での動作が確認されている:
|
|
|
|
\begin{itemize}
|
|
\item {OS: NixOS 25.11 Xantusia, Linux 7.0.3 x86\_64}
|
|
\item {CC: GCC 15.2.0}
|
|
\item {CFLAGS: \texttt{-g -O1 -Wall -Wpedantic}}
|
|
\item {ファイルエンコーディング: UTF-8}
|
|
\end{itemize}
|
|
|
|
\section{補助関数郡}
|
|
|
|
今回の課題では前期第3回課題で作成した関数を使用する.再利用性を高めるために\texttt{reduce.h}を作成した.
|
|
|
|
\lstinputlisting[language=C,title={\texttt{reduce.h}}]{src/cls04/reduce.h}
|
|
|
|
また,分数の入出力等に関する関数を\texttt{utils.h}に記述した.
|
|
|
|
\lstinputlisting[language=C,title={\texttt{utils.h}}]{src/cls04/utils.h}
|
|
|
|
\newpage
|
|
|
|
\section{課題1}
|
|
|
|
\texttt{reduce}関数を用いて分数どうしの加算を行うプログラム.
|
|
|
|
\lstinputlisting[language=C,title={課題1のプログラム}]{src/cls04/a1.c}
|
|
|
|
\subsection{実行結果}
|
|
|
|
\begin{figure}[tbh]
|
|
\centering
|
|
\includegraphics[width=12cm]{assets/cls04-a1.png}
|
|
\caption{課題1の実行結果}
|
|
\end{figure}
|
|
|
|
\newpage
|
|
|
|
\section{課題2}
|
|
|
|
\texttt{reduce}関数を用いて分数どうしの減算を行うプログラム.
|
|
|
|
\lstinputlisting[language=C,title={課題2のプログラム}]{src/cls04/a2.c}
|
|
|
|
\subsection{実行結果}
|
|
|
|
\begin{figure}[tbh]
|
|
\centering
|
|
\includegraphics[width=12cm]{assets/cls04-a2.png}
|
|
\caption{課題2の実行結果}
|
|
\end{figure}
|
|
|
|
\newpage
|
|
|
|
\section{課題3}
|
|
|
|
\texttt{reduce}関数を用いて分数どうしの乗算を行うプログラム.
|
|
|
|
\lstinputlisting[language=C,title={課題3のプログラム}]{src/cls04/a3.c}
|
|
|
|
\subsection{実行結果}
|
|
|
|
\begin{figure}[tbh]
|
|
\centering
|
|
\includegraphics[width=12cm]{assets/cls04-a3.png}
|
|
\caption{課題3の実行結果}
|
|
\end{figure}
|
|
|
|
\newpage
|
|
|
|
\section{課題4}
|
|
|
|
標準入力から自然数を取得する関数\texttt{getnum}を作成する.
|
|
|
|
\lstinputlisting[language=C,title={課題4のプログラム}]{src/cls04/a4.c}
|
|
|
|
\subsection{実行結果}
|
|
|
|
\begin{figure}[tbh]
|
|
\centering
|
|
\includegraphics[width=12cm]{assets/cls04-a4.png}
|
|
\caption{課題4の実行結果}
|
|
\end{figure}
|
|
\end{document}
|