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/p413.png b/assets/p413.png new file mode 100644 index 0000000..71f8420 Binary files /dev/null and b/assets/p413.png differ diff --git a/assets/p414.png b/assets/p414.png new file mode 100644 index 0000000..781b454 Binary files /dev/null and b/assets/p414.png differ diff --git a/assets/p418.png b/assets/p418.png new file mode 100644 index 0000000..8533ee1 Binary files /dev/null and b/assets/p418.png differ diff --git a/assets/p419.png b/assets/p419.png new file mode 100644 index 0000000..ac2002f Binary files /dev/null and b/assets/p419.png differ diff --git a/document.yaml b/document.yaml index c49334c..faedf88 100644 --- a/document.yaml +++ b/document.yaml @@ -1,28 +1,28 @@ doc_class: nitreport -title: Insert Title Here +title: 第14回課題 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: 15日 turnin: year: 令和7年 - month: cc月 - day: dd日 + month: 07月 + day: 17日 -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,9 @@ 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/p413.tex', newpg: false } + - { path: 'section/p414.tex', newpg: false } + - { path: 'section/p418.tex', newpg: false } + - { path: 'section/p419.tex', newpg: false } diff --git a/main.tex b/main.tex new file mode 100644 index 0000000..1aa00f9 --- /dev/null +++ b/main.tex @@ -0,0 +1,39 @@ +\documentclass{class/nitreport} + +\reporttitle{第14回課題} +\reportauthor{柴田 健琉} +\studentid{2024D14} +\seatingnum{15} +\reportdate{令和7年}{07月}{15日} +\turnindate{令和7年}{07月}{17日} +\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/p413.tex} + + \input{section/p414.tex} + + \input{section/p418.tex} + + \input{section/p419.tex} + + \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-opt-final.pdf b/output/main-opt-final.pdf new file mode 100644 index 0000000..1b3410c 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..66a3bb8 Binary files /dev/null and b/output/main.pdf differ diff --git a/programs/p413/info.json b/programs/p413/info.json new file mode 100644 index 0000000..14b3a12 --- /dev/null +++ b/programs/p413/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習 4-13", + "description": "1から$n$までの総和を求めるプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/p413.png" + }, + "note": "" +} diff --git a/programs/p413/main b/programs/p413/main new file mode 100755 index 0000000..195538f Binary files /dev/null and b/programs/p413/main differ diff --git a/programs/p413/main.c b/programs/p413/main.c new file mode 100644 index 0000000..0bdc82e --- /dev/null +++ b/programs/p413/main.c @@ -0,0 +1,23 @@ +#include + +int main(void) { + int n; + int sum = 0; + +numInput: + printf("Input integer: "); + scanf("%d", &n); + + if (n < 1) { + puts("Error: Please type in non-zero positive integer."); + goto numInput; + } + + for (int i = 1; i <= n; i++) { + sum += i; + } + + printf("ANS: %d", sum); + + return 0; +} diff --git a/programs/p414/info.json b/programs/p414/info.json new file mode 100644 index 0000000..b2f410a --- /dev/null +++ b/programs/p414/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習 4-14", + "description": "1,2,3...8,9,0を入力した整数値個表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/p414.png" + }, + "note": "" +} diff --git a/programs/p414/main b/programs/p414/main new file mode 100755 index 0000000..0c4c107 Binary files /dev/null and b/programs/p414/main differ diff --git a/programs/p414/main.c b/programs/p414/main.c new file mode 100644 index 0000000..c678417 --- /dev/null +++ b/programs/p414/main.c @@ -0,0 +1,22 @@ +#include + +int main(void) { + int n; + +numInput: + printf("Input positive integer: "); + scanf("%d", &n); + + if (n < 0) { + puts("Please input positive integer."); + goto numInput; + } + + for (int i = 1; i <= n; i++) { + printf("%d", i % 10); + } + + putchar('\n'); + + return 0; +} diff --git a/programs/p418/info.json b/programs/p418/info.json new file mode 100644 index 0000000..8c6a0e6 --- /dev/null +++ b/programs/p418/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習 4-18", + "description": "入力した整数値の個数分アスタリスクを各行に5個ずつ表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/p418.png" + }, + "note": "" +} diff --git a/programs/p418/main b/programs/p418/main new file mode 100755 index 0000000..533dd8f Binary files /dev/null and b/programs/p418/main differ diff --git a/programs/p418/main.c b/programs/p418/main.c new file mode 100644 index 0000000..a3cf0bc --- /dev/null +++ b/programs/p418/main.c @@ -0,0 +1,25 @@ +#include + +#define CHARSPERLINE 5 + +int main(void) { + int n; + +numInput: + printf("Input integer: "); + scanf("%d", &n); + + if (n < 1) { + puts("Please input non-zero positive integer."); + goto numInput; + } + + for (int i = 1; i <= n; i++) { + putchar('*'); + if (i % CHARSPERLINE == 0) { + putchar('\n'); + } + } + + return 0; +} diff --git a/programs/p419/info.json b/programs/p419/info.json new file mode 100644 index 0000000..e508c79 --- /dev/null +++ b/programs/p419/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習 4-19", + "description": "入力した整数値の全約数とその個数を表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/p419.png" + }, + "note": "" +} diff --git a/programs/p419/main b/programs/p419/main new file mode 100755 index 0000000..21993c4 Binary files /dev/null and b/programs/p419/main differ diff --git a/programs/p419/main.c b/programs/p419/main.c new file mode 100644 index 0000000..0568295 --- /dev/null +++ b/programs/p419/main.c @@ -0,0 +1,26 @@ +#include + +int main(void) { + int n; + int factors = 0; + +numInput: + printf("Input integer: "); + scanf("%d", &n); + + if (n < 1) { + puts("Please input positive integer."); + goto numInput; + } + + for (int i = 1; i <= n; i++) { + if (n % i == 0) { + printf("%d\n", i); + factors++; + } + } + + printf("Number of factors: %d\n", factors); + + return 0; +} diff --git a/references.bib b/references.bib index bc328a4..c8b90bc 100644 --- a/references.bib +++ b/references.bib @@ -1,9 +1,6 @@ -@online{example, - title = {Example Entry}, - author = {Inc., Example}, - organization = {Example, Inc.}, - url = {https://www.example.com}, - year = {1970}, - month = {01}, - urldate = {1970-01-01} +@online{cppref, + title = {for loop}, + author = {cppreference}, + url = {https://en.cppreference.com/w/c/language/for.html}, + urldate = {2025-07-17} } 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/p413.tex b/section/p413.tex new file mode 100644 index 0000000..ec98ee4 --- /dev/null +++ b/section/p413.tex @@ -0,0 +1,13 @@ +\section{演習 4-13} + +1から$n$までの総和を求めるプログラム。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習 4-13}]{../programs/p413/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p413.png} +\end{center} diff --git a/section/p414.tex b/section/p414.tex new file mode 100644 index 0000000..553718b --- /dev/null +++ b/section/p414.tex @@ -0,0 +1,13 @@ +\section{演習 4-14} + +1,2,3...8,9,0を入力した整数値個表示するプログラム。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習 4-14}]{../programs/p414/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p414.png} +\end{center} diff --git a/section/p418.tex b/section/p418.tex new file mode 100644 index 0000000..935b117 --- /dev/null +++ b/section/p418.tex @@ -0,0 +1,13 @@ +\section{演習 4-18} + +入力した整数値の個数分アスタリスクを各行に5個ずつ表示するプログラム。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習 4-18}]{../programs/p418/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p418.png} +\end{center} diff --git a/section/p419.tex b/section/p419.tex new file mode 100644 index 0000000..970692b --- /dev/null +++ b/section/p419.tex @@ -0,0 +1,13 @@ +\section{演習 4-19} + +入力した整数値の全約数とその個数を表示するプログラム。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習 4-19}]{../programs/p419/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p419.png} +\end{center} diff --git a/section/syntax.tex b/section/syntax.tex new file mode 100644 index 0000000..2ec0005 --- /dev/null +++ b/section/syntax.tex @@ -0,0 +1,23 @@ +\section{今回の構文} + +\section{\texttt{for}文} + +\texttt{for}文は繰り返しを記述する方法の一つで、1つの文と2つ式で構成される。 +それぞれの式・文はセミコロンで分けられている。 +\cite{cppref} + +\defaultlistingstyle +\begin{lstlisting}[language=C, title={\texttt{for}文}] +for (<カウンターの初期化文> ; <条件式> ; <反復式>) { + <文>...; +} +\end{lstlisting} + +初期化文、条件式、反復式を全て省略すると無限ループになる。 + +\begin{lstlisting}[language=C, title={\texttt{for}文による無限ループ}] +for (;;) { + <文>...; +} +\end{lstlisting} +