diff --git a/assets/lst22.png b/assets/lst22.png new file mode 100644 index 0000000..2e10378 Binary files /dev/null and b/assets/lst22.png differ diff --git a/assets/prog1.png b/assets/prog1.png new file mode 100644 index 0000000..01496e3 Binary files /dev/null and b/assets/prog1.png differ diff --git a/assets/prog2.png b/assets/prog2.png new file mode 100644 index 0000000..a7a4b90 Binary files /dev/null and b/assets/prog2.png differ diff --git a/assets/rev3dig.png b/assets/rev3dig.png new file mode 100644 index 0000000..dbd2116 Binary files /dev/null and b/assets/rev3dig.png differ diff --git a/document.yaml b/document.yaml index 2c966d9..e3c2e5d 100644 --- a/document.yaml +++ b/document.yaml @@ -1,23 +1,23 @@ doc_class: nitreport -title: Insert Title Here +title: 第4回課題 author: - name: 高専 太郎 - student_id: 0000-01 - seating_number: 1 + name: 柴田 健琉 + student_id: 2024D14 + seating_number: 15 date: year: 令和7年 - month: aa月 - day: bb日 + month: 05月 + day: 01日 turnin: year: 令和7年 - month: cc月 - day: dd日 + month: 05月 + day: 04日 -school_name: abc高専 -department: 一般科 -subject: 〇〇概論 -professor: □□教員 +school_name: 岐阜工業高等専門学校 +department: 電子制御工学科 +subject: 情報処理I +professor: 岡崎 憲一教員 page_config: include_cover_page: true @@ -31,5 +31,8 @@ page_config: sections: - { path: 'section/introduction.tex', newpg: true } - - { path: 'md-out/test.tex', newpg: false } + - { path: 'section/prog1.tex', newpg: true } + - { path: 'section/prog2.tex', newpg: true } + - { path: 'section/lst22.tex', newpg: true } + - { path: 'section/rev3dig.tex', newpg: true } diff --git a/main.tex b/main.tex new file mode 100644 index 0000000..3767dea --- /dev/null +++ b/main.tex @@ -0,0 +1,41 @@ +\documentclass{class/nitreport} + +\reporttitle{第4回課題} +\reportauthor{柴田 健琉} +\studentid{2024D14} +\seatingnum{15} +\reportdate{令和7年}{05月}{01日} +\turnindate{令和7年}{05月}{04日} +\schoolname{岐阜工業高等専門学校} +\department{電子制御工学科} +\subject{情報処理I} +\professor{岡崎 憲一教員} + +\pagenumbering{roman} + +\begin{document} + \coverpage + + \tableofcontents + \newpage + \pagenumbering{arabic} + + \input{section/introduction.tex} + \newpage + + \input{section/prog1.tex} + \newpage + + \input{section/prog2.tex} + \newpage + + \input{section/lst22.tex} + \newpage + + \input{section/rev3dig.tex} + \newpage + + \printbibliography[heading=bibintoc,title={参考文献}] + + \compiledTime +\end{document} \ No newline at end of file diff --git a/markdown/test.md b/markdown/test.md deleted file mode 100644 index 9fdd1bf..0000000 --- a/markdown/test.md +++ /dev/null @@ -1,18 +0,0 @@ -# Hi - -| x | y | -| --- | --- | -| 0 | 0 | -| 1 | 1 | -| 2 | 2 | -| 3 | 3 | -| 4 | 4 | - -* i1 -* i2 -* i3 - -1. n1 -2. n2 -3. n3 - diff --git a/output/main-opt-final.pdf b/output/main-opt-final.pdf new file mode 100644 index 0000000..0018739 Binary files /dev/null and b/output/main-opt-final.pdf differ diff --git a/output/main.pdf b/output/main.pdf new file mode 100644 index 0000000..8f04268 Binary files /dev/null and b/output/main.pdf differ diff --git a/programs/lst22/info.json b/programs/lst22/info.json new file mode 100644 index 0000000..5cb5573 --- /dev/null +++ b/programs/lst22/info.json @@ -0,0 +1,8 @@ +{ + "name": "List 2ー2 +$\\\\alpha$", + "description": "2桁以上の正の整数の十の位の数字を表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/lst22.png" + } +} diff --git a/programs/lst22/main b/programs/lst22/main new file mode 100755 index 0000000..573f886 Binary files /dev/null and b/programs/lst22/main differ diff --git a/programs/lst22/main.c b/programs/lst22/main.c new file mode 100644 index 0000000..0135142 --- /dev/null +++ b/programs/lst22/main.c @@ -0,0 +1,18 @@ +#include + +int main(void) { + int n; + + printf("Integer n: "); + scanf("%d", &n); + + // Don't trust user input + if (n < 10) { + printf("Integer n must be more than 2 digits."); + return 1; + } + + printf("Tens digit of interger n is %d.", n / 10 % 10); + + return 0; +} diff --git a/programs/prog1/info.json b/programs/prog1/info.json new file mode 100644 index 0000000..49f0536 --- /dev/null +++ b/programs/prog1/info.json @@ -0,0 +1,8 @@ +{ + "name": "演習 2ー1", + "description": "2つの整数値を読み込み、前者の値が後者の何\\%であるかを表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/prog1.png" + } +} diff --git a/programs/prog1/main b/programs/prog1/main new file mode 100755 index 0000000..f018d4e Binary files /dev/null and b/programs/prog1/main differ diff --git a/programs/prog1/main.c b/programs/prog1/main.c new file mode 100644 index 0000000..82bda73 --- /dev/null +++ b/programs/prog1/main.c @@ -0,0 +1,15 @@ +#include + +int main(void) { + int x; + int y; + + printf("Integer x: "); + scanf("%d", &x); + printf("Integer y: "); + scanf("%d", &y); + + printf("Value of x is %d%% of y.", x * 100 / y); + + return 0; +} diff --git a/programs/prog2/info.json b/programs/prog2/info.json new file mode 100644 index 0000000..2f2363d --- /dev/null +++ b/programs/prog2/info.json @@ -0,0 +1,8 @@ +{ + "name": "演習 2ー2", + "description": "2つの整数値を読み込み、それらの和と積を表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/prog2.png" + } +} diff --git a/programs/prog2/main b/programs/prog2/main new file mode 100755 index 0000000..c912b68 Binary files /dev/null and b/programs/prog2/main differ diff --git a/programs/prog2/main.c b/programs/prog2/main.c new file mode 100644 index 0000000..9fa45b0 --- /dev/null +++ b/programs/prog2/main.c @@ -0,0 +1,15 @@ +#include + +int main(void) { + int a; + int b; + + printf("Integer a: "); + scanf("%d", &a); + printf("Integer b: "); + scanf("%d", &b); + + printf("Sum of two integers is %d, and product is %d.", a+b, a*b); + + return 0; +} diff --git a/programs/rev3dig/info.json b/programs/rev3dig/info.json new file mode 100644 index 0000000..1c2ace1 --- /dev/null +++ b/programs/rev3dig/info.json @@ -0,0 +1,8 @@ +{ + "name": "課題4", + "description": "入力した三桁の正の整数の数字の並びを逆順させた数字を表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/rev3dig.png" + } +} diff --git a/programs/rev3dig/main b/programs/rev3dig/main new file mode 100755 index 0000000..03bad8d Binary files /dev/null and b/programs/rev3dig/main differ diff --git a/programs/rev3dig/main.c b/programs/rev3dig/main.c new file mode 100644 index 0000000..a9b28e8 --- /dev/null +++ b/programs/rev3dig/main.c @@ -0,0 +1,26 @@ +#include + +int main(void) { + int n; + + printf("Integer n: "); + scanf("%d", &n); + + // Throw error when n is not in range of 100 <= n <= 999 + if (n < 100 || n > 999) { + printf("Integer n must be 3 digit number"); + return 1; + } + + int a, b, c, m; // a * 10^2 + b * 10^1 + c * 10^0 = n + + a = n / 100; + b = n / 10 % 10; + c = n % 10; + + m = c * 100 + b * 10 + a; // m is reversed n + + printf("Reversed integer is %d.", m); + + return 0; +} diff --git a/section/introduction.tex b/section/introduction.tex index 6347545..7870de2 100644 --- a/section/introduction.tex +++ b/section/introduction.tex @@ -1,67 +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!} - -\defaultlistingstyle - -\begin{lstlisting}[language=C, caption=Basic Hello World] -#include - -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 <ソースコード名> -o <プログラム名>} \end{itemize} - -\begin{enumerate} - \item lualatex .tex - \item biber - \item lualatex .tex - \item lualatex .tex -\end{enumerate} - -\newpage - -\section{Section} - -section - -\subsection{Sub Section} - -sub section - -\paragraph{Paragraph} - -paragraph diff --git a/section/lst22.tex b/section/lst22.tex new file mode 100644 index 0000000..13957e5 --- /dev/null +++ b/section/lst22.tex @@ -0,0 +1,14 @@ +\section{List 2ー2 +$\alpha$} + +2桁以上の正の整数の十の位の数字を表示するプログラム。 + +\subsection{コードリスティング} + +\defaultlistingstyle +\lstinputlisting[language=C,title={List 2ー2 +$\alpha$}]{../programs/lst22/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/lst22.png} +\end{center} diff --git a/section/prog1.tex b/section/prog1.tex new file mode 100644 index 0000000..e39d9be --- /dev/null +++ b/section/prog1.tex @@ -0,0 +1,14 @@ +\section{演習 2ー1} + +2つの整数値を読み込み、前者の値が後者の何\%であるかを表示するプログラム。 + +\subsection{コードリスティング} + +\defaultlistingstyle +\lstinputlisting[language=C,title={演習 2ー1}]{../programs/prog1/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/prog1.png} +\end{center} diff --git a/section/prog2.tex b/section/prog2.tex new file mode 100644 index 0000000..466d5d3 --- /dev/null +++ b/section/prog2.tex @@ -0,0 +1,14 @@ +\section{演習 2ー2} + +2つの整数値を読み込み、それらの和と積を表示するプログラム。 + +\subsection{コードリスティング} + +\defaultlistingstyle +\lstinputlisting[language=C,title={演習 2ー2}]{../programs/prog2/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/prog2.png} +\end{center} diff --git a/section/rev3dig.tex b/section/rev3dig.tex new file mode 100644 index 0000000..e08a505 --- /dev/null +++ b/section/rev3dig.tex @@ -0,0 +1,16 @@ +\section{課題4} + +入力した三桁の正の整数の数字の並びを逆順させた数字を表示するプログラム。 + +\subsection{コードリスティング} + +\vspace{-0.5cm} + +\defaultlistingstyle +\lstinputlisting[language=C,title={課題4}]{../programs/rev3dig/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=12cm]{./assets/rev3dig.png} +\end{center} diff --git a/section/syntax.tex b/section/syntax.tex new file mode 100644 index 0000000..e69de29