diff --git a/Makefile b/Makefile index a168c6f..7605ed6 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ BIBFLAGS := --input-directory=$(OUTDIR) --output-directory=$(OUTDIR)/ PRINTFORMAT := "\033[1;92;49m%s\033[m\n" -USE_MARKDOWN := true +USE_MARKDOWN := false MARKDOWNS := $(wildcard markdown/*.md) MARKDOWN_OUTPUTS := $(patsubst markdown/%.md,md-out/%.tex,$(MARKDOWNS)) diff --git a/assets/p41.png b/assets/p41.png new file mode 100644 index 0000000..1ce6fa1 Binary files /dev/null and b/assets/p41.png differ diff --git a/assets/p42.png b/assets/p42.png new file mode 100644 index 0000000..8694279 Binary files /dev/null and b/assets/p42.png differ diff --git a/assets/p43.png b/assets/p43.png new file mode 100644 index 0000000..4f21382 Binary files /dev/null and b/assets/p43.png differ diff --git a/assets/p44.png b/assets/p44.png new file mode 100644 index 0000000..f5e842b Binary files /dev/null and b/assets/p44.png differ diff --git a/document.yaml b/document.yaml index c49334c..12414f1 100644 --- a/document.yaml +++ b/document.yaml @@ -1,28 +1,28 @@ doc_class: nitreport -title: Insert Title Here +title: 第12回課題 author: - name: 高専 太郎 - student_id: 0000-01 - seating_number: 1 + name: 柴田 健琉 + student_id: 2024D14 + seating_number: 15 date: year: 令和7年 - month: aa月 - day: bb日 + month: 07月 + day: 03日 turnin: year: 令和7年 - month: cc月 - day: dd日 + month: 07月 + day: 03日 -school_name: abc高専 -department: 一般科 -subject: 〇〇概論 -professor: □□教員 +school_name: 岐阜工業高等専門学校 +department: 電子制御工学科 +subject: 情報処理I +professor: 岡崎 憲一 paper_config: include_cover_page: true include_table_of_contents: true - use_bib: false + use_bib: true use_additional_packages: false show_compiled_time: true @@ -31,6 +31,10 @@ paper_config: # - { name: "pkg-wo-opt", options: "" } sections: - - { path: 'section/introduction.tex', newpg: true } - - { path: 'md-out/test.tex', newpg: false } + - { path: 'section/introduction.tex', newpg: false } + - { path: 'section/syntax.tex', newpg: true } + - { path: 'section/p41.tex', newpg: true } + - { path: 'section/p42.tex', newpg: true } + - { path: 'section/p43.tex', newpg: true } + - { path: 'section/p44.tex', newpg: true } diff --git a/main.tex b/main.tex new file mode 100644 index 0000000..53edf83 --- /dev/null +++ b/main.tex @@ -0,0 +1,43 @@ +\documentclass{class/nitreport} + +\reporttitle{第12回課題} +\reportauthor{柴田 健琉} +\studentid{2024D14} +\seatingnum{15} +\reportdate{令和7年}{07月}{03日} +\turnindate{令和7年}{07月}{03日} +\schoolname{岐阜工業高等専門学校} +\department{電子制御工学科} +\subject{情報処理I} +\professor{岡崎 憲一} + +\pagenumbering{roman} + +\begin{document} + \coverpage + + \tableofcontents + \newpage + \pagenumbering{arabic} + + \input{section/introduction.tex} + + \input{section/syntax.tex} + \newpage + + \input{section/p41.tex} + \newpage + + \input{section/p42.tex} + \newpage + + \input{section/p43.tex} + \newpage + + \input{section/p44.tex} + \newpage + + \printbibliography[heading=bibintoc,title={参考文献}] + + \compiledTime +\end{document} 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.pdf b/output/main.pdf new file mode 100644 index 0000000..64fac0a Binary files /dev/null and b/output/main.pdf differ diff --git a/programs/p41/info.json b/programs/p41/info.json new file mode 100644 index 0000000..8c3a3cc --- /dev/null +++ b/programs/p41/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "課題1", + "description": "教科書の演習4ー1の解答", + "output": { + "type": "screenshot", + "content": "./assets/p41.png" + }, + "note": "" +} diff --git a/programs/p41/main b/programs/p41/main new file mode 100755 index 0000000..02cd522 Binary files /dev/null and b/programs/p41/main differ diff --git a/programs/p41/main.c b/programs/p41/main.c new file mode 100644 index 0000000..0a8d015 --- /dev/null +++ b/programs/p41/main.c @@ -0,0 +1,24 @@ +#include + +int main(void) { + int n; + int retry = 1; + + do { + printf("Input integer: "); + scanf("%d", &n); + + if (n > 0) { + printf("%d is positive.\n", n); + } else if (n < 0) { + printf("%d is negative.\n", n); + } else { + printf("It is zero.\n"); + } + + printf("Retry? [1/0]: "); + scanf("%d", &retry); + } while (retry == 1); + + return 0; +} diff --git a/programs/p42/info.json b/programs/p42/info.json new file mode 100644 index 0000000..665f96f --- /dev/null +++ b/programs/p42/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "課題2", + "description": "教科書の演習4ー2の解答", + "output": { + "type": "screenshot", + "content": "./assets/p42.png" + }, + "note": "" +} diff --git a/programs/p42/main b/programs/p42/main new file mode 100755 index 0000000..c15d588 Binary files /dev/null and b/programs/p42/main differ diff --git a/programs/p42/main.c b/programs/p42/main.c new file mode 100644 index 0000000..e295cd4 --- /dev/null +++ b/programs/p42/main.c @@ -0,0 +1,21 @@ +#include + +int main(void) { + int a, b, i, ans; + + printf("Input upper limit: "); + (void)scanf("%d", &a); + printf("Input lower limit: "); + (void)scanf("%d", &b); + + i = b; + ans = 0; + + do { + ans += i++; + } while (i <= a); + + printf("Sum of all integer between %d and %d is %d.\n", b, a, ans); + + return 0; +} diff --git a/programs/p43/info.json b/programs/p43/info.json new file mode 100644 index 0000000..8237278 --- /dev/null +++ b/programs/p43/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "課題3", + "description": "教科書の演習4ー3の解答", + "output": { + "type": "screenshot", + "content": "./assets/p43.png" + }, + "note": "" +} diff --git a/programs/p43/main b/programs/p43/main new file mode 100755 index 0000000..3993b04 Binary files /dev/null and b/programs/p43/main differ diff --git a/programs/p43/main.c b/programs/p43/main.c new file mode 100644 index 0000000..521d885 --- /dev/null +++ b/programs/p43/main.c @@ -0,0 +1,19 @@ +#include + +int main(void) { + int n; + + printf("Input positive integer: "); + scanf("%d", &n); + + while (n >= 0) { + printf("%d ", n); + n--; + + if (n < 0) { + printf("\n"); + } + } + + return 0; +} diff --git a/programs/p44/info.json b/programs/p44/info.json new file mode 100644 index 0000000..54ce428 --- /dev/null +++ b/programs/p44/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "課題4", + "description": "教科書の演習4ー4の解答", + "output": { + "type": "screenshot", + "content": "./assets/p44.png" + }, + "note": "" +} diff --git a/programs/p44/main b/programs/p44/main new file mode 100755 index 0000000..22013c5 Binary files /dev/null and b/programs/p44/main differ diff --git a/programs/p44/main.c b/programs/p44/main.c new file mode 100644 index 0000000..1d264e6 --- /dev/null +++ b/programs/p44/main.c @@ -0,0 +1,18 @@ +#include + +int main(void) { + int n; + + printf("Input positive integer: "); + scanf("%d", &n); + + while (n > 0) { + printf("%d ", n--); + + if (n == 0) { + printf("\n"); + } + } + + return 0; +} diff --git a/section/introduction.tex b/section/introduction.tex index 3386076..b03c6d7 100644 --- a/section/introduction.tex +++ b/section/introduction.tex @@ -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 - -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 .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/p41.tex b/section/p41.tex new file mode 100644 index 0000000..0e9fbae --- /dev/null +++ b/section/p41.tex @@ -0,0 +1,13 @@ +\section{課題1} + +教科書の演習4ー1の解答 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={課題1}]{../programs/p41/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p41.png} +\end{center} diff --git a/section/p42.tex b/section/p42.tex new file mode 100644 index 0000000..b61fe6f --- /dev/null +++ b/section/p42.tex @@ -0,0 +1,13 @@ +\section{課題2} + +教科書の演習4ー2の解答 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={課題2}]{../programs/p42/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p42.png} +\end{center} diff --git a/section/p43.tex b/section/p43.tex new file mode 100644 index 0000000..a6cabb1 --- /dev/null +++ b/section/p43.tex @@ -0,0 +1,13 @@ +\section{課題3} + +教科書の演習4ー3の解答 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={課題3}]{../programs/p43/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p43.png} +\end{center} diff --git a/section/p44.tex b/section/p44.tex new file mode 100644 index 0000000..7b378cb --- /dev/null +++ b/section/p44.tex @@ -0,0 +1,13 @@ +\section{課題4} + +教科書の演習4ー4の解答 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={課題4}]{../programs/p44/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p44.png} +\end{center} diff --git a/section/syntax.tex b/section/syntax.tex new file mode 100644 index 0000000..839e935 --- /dev/null +++ b/section/syntax.tex @@ -0,0 +1,12 @@ +\section{今回の構文} + +\subsection{\texttt{while}文} + +繰り返しを記述する構文の一つで、こちらはループ内の処理を行う前に条件式を評価する。 + +\defaultlistingstyle +\begin{lstlisting}[language=C,title={\texttt{while}文}] +while (<条件式>) { + 文...; +} +\end{lstlisting}