This commit is contained in:
2025-06-26 15:18:33 +09:00
parent e027e09906
commit 451aaee7ce
33 changed files with 366 additions and 106 deletions

13
section/a1.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{課題1}
入力した整数値が1桁の自然数に含まれるかを判定するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={課題1}]{../programs/a1/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/a1.png}
\end{center}

13
section/a2.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{課題2}
入力した3つの整数値が小さい順または等価になっているかを検証するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={課題2}]{../programs/a2/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/a2.png}
\end{center}

27
section/a3.tex Normal file
View File

@@ -0,0 +1,27 @@
\section{課題3}
二次方程式の解の種類を判別するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={課題3}]{../programs/a3/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/a3.png}
\end{center}
\subsection{考察}
上記のコードリストは浮動少数点数の演算・変数格納時の誤差を考慮していない。
考慮する場合は\texttt{float.h}内の\texttt{DBL\_MIN}\texttt{DBL\_EPSILON}を用いた判別処理が必要である\cite{cppref_float}
\begin{lstlisting}[language=C,title={誤差を考慮した比較}]
#include <float.h>
#include <math.h>
if (D == DBL_EPSILON * fmax(1, fmax(fabs(D), 0.0))) {
puts("superposition");
}
\end{lstlisting}

13
section/a4.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{課題4}
1年の月の日数を返すプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={課題4}]{../programs/a4/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/a4.png}
\end{center}

13
section/a5.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{課題5}
第10回の課題「簡易電卓」を繰り返し計算できるように変更したプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={課題5}]{../programs/a5/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/a5.png}
\end{center}

View File

@@ -1,70 +1,12 @@
\section{はじめに}
Start Writing!
\subsection{実行環境}
Use lualatex + biber to compile.
この課題のプログラムは以下の環境で動作することが確認されている:
Test Bib\cite{example}
いろはにほへと ちりぬるを
{\gtfamily \sffamily \LaTeX で自由な組版を。}
{\gtfamily \sffamily Write freely with \LaTeX{}.}
{\ttfamily LaTeX shall be free forever!}
\noindent
この行のテキストは四十二字です。ああああああああああああああああああああああああああいいいい
\defaultlistingstyle
\begin{lstlisting}[language=C, caption=Basic Hello World]
#include <stdlib.h>
int square(int n) {
return n*n;
}
int main(int argc, char** argv) {
char* msg = "Hello World";
int x = 3;
int y = square(x);
printf("%s\n", msg);
printf("f(x) = x^2; x: %d, y: %d\n", x, y);
return 0;
}
\end{lstlisting}
\begin{displaymath}
\int_{a}^{b} f(x) \,dx = F(b)-F(a)
\end{displaymath}
\begin{itemize}
\item C
\item Python
\item Javascript
\item Rust
\item Haskell
\item OS: Arch Linux
\item CPU アーキテクチャ: \texttt{x86\_64}
\item C コンパイラ: \texttt{gcc バージョン 14.2.1 20250322 (GCC)}
\item C コンパイラオプション: \texttt{-Wall}
\end{itemize}
\begin{enumerate}
\item lualatex <filename>.tex
\item biber <filename>
\item lualatex <filename>.tex
\item lualatex <filename>.tex
\end{enumerate}
\newpage
\section{Section}
section
\subsection{Sub Section}
sub section
\paragraph{Paragraph}
paragraph

12
section/syntax.tex Normal file
View File

@@ -0,0 +1,12 @@
\section{今回の構文}
\subsection{\texttt{do-while}}
\texttt{do-while}文は繰り返しを行う処理の一つでブロック内の処理を終えるたびにループの条件式を評価する。
\defaultlistingstyle
\begin{lstlisting}[language=C,title={\texttt{do-while}}]
do {
文...
} while (式);
\end{lstlisting}