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

View File

@@ -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))

BIN
assets/a1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

BIN
assets/a2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 KiB

BIN
assets/a3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 KiB

BIN
assets/a4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 KiB

BIN
assets/a5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -1,28 +1,28 @@
doc_class: nitreport
title: Insert Title Here
title: 第11回課題
author:
name: 高専 太郎
student_id: 0000-01
seating_number: 1
name: 柴田健琉
student_id: 2024D14
seating_number: 15
date:
year: 令和7年
month: aa
day: bb
month: 06
day: 26
turnin:
year: 令和7年
month: cc
day: dd
month: 06
day: 26
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,11 @@ 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/a1.tex', newpg: true }
- { path: 'section/a2.tex', newpg: true }
- { path: 'section/a3.tex', newpg: true }
- { path: 'section/a4.tex', newpg: true }
- { path: 'section/a5.tex', newpg: true }

46
main.tex Normal file
View File

@@ -0,0 +1,46 @@
\documentclass{class/nitreport}
\reporttitle{第11回課題}
\reportauthor{柴田健琉}
\studentid{2024D14}
\seatingnum{15}
\reportdate{令和7年}{06月}{26日}
\turnindate{令和7年}{06月}{26日}
\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/a1.tex}
\newpage
\input{section/a2.tex}
\newpage
\input{section/a3.tex}
\newpage
\input{section/a4.tex}
\newpage
\input{section/a5.tex}
\newpage
\printbibliography[heading=bibintoc,title={参考文献}]
\compiledTime
\end{document}

View File

@@ -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

BIN
output/main.pdf Normal file

Binary file not shown.

10
programs/a1/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題1",
"description": "入力した整数値が1桁の自然数に含まれるかを判定するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/a1.png"
},
"note": ""
}

BIN
programs/a1/main Executable file

Binary file not shown.

16
programs/a1/main.c Normal file
View File

@@ -0,0 +1,16 @@
#include <stdio.h>
int main(void) {
int n;
printf("Input integer: ");
scanf("%d", &n);
if (n <= 10 && n > 0) {
printf("%d is one digit natural number.\n", n);
} else {
printf("%d is not one digit natural number.\n", n);
}
return 0;
}

10
programs/a2/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題2",
"description": "入力した3つの整数値が小さい順または等価になっているかを検証するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/a2.png"
},
"note": ""
}

BIN
programs/a2/main Executable file

Binary file not shown.

24
programs/a2/main.c Normal file
View File

@@ -0,0 +1,24 @@
#include <stdio.h>
int main(void) {
int a, b, c;
printf("Input integer #1: ");
scanf("%d", &a);
printf("Input integer #2: ");
scanf("%d", &b);
printf("Input integer #3: ");
scanf("%d", &c);
if (a <= b) {
if (b <= c) {
puts("OK");
} else {
puts("NG");
}
} else {
puts("NG");
}
return 0;
}

10
programs/a3/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題3",
"description": "二次方程式の解の種類を判別するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/a3.png"
},
"note": "上記のコードリストは浮動少数点数の演算・変数格納時の誤差を考慮していない。\\n考慮する場合は\\\\texttt{float.h}内の\\\\texttt{DBL_MIN}や\\\\texttt{DBL_EPSILON}を用いた判別処理が必要である。"
}

BIN
programs/a3/main Executable file

Binary file not shown.

24
programs/a3/main.c Normal file
View File

@@ -0,0 +1,24 @@
#include <stdio.h>
int main(void) {
double a, b, c, D;
printf("a: ");
scanf("%lf", &a);
printf("b: ");
scanf("%lf", &b);
printf("c: ");
scanf("%lf", &c);
D = b * b - 4 * a * c;
if (D == 0.0) {
puts("Superposition");
} else if (D < 0.0) {
puts("Two complex answers");
} else if (D > 0.0) {
puts("Two real answers");
}
return 0;
}

10
programs/a4/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題4",
"description": "1年の月の日数を返すプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/a4.png"
},
"note": ""
}

BIN
programs/a4/main Executable file

Binary file not shown.

29
programs/a4/main.c Normal file
View File

@@ -0,0 +1,29 @@
#include <stdio.h>
int main(void) {
int month;
printf("Input month: ");
scanf("%d", &month);
if (month < 1 || month > 12) {
puts("Unknown month");
return 1;
}
switch (month) {
case 2:
puts("28 days");
break;
case 4:
case 6:
case 9:
case 11:
puts("30 days");
break;
default:
puts("31 days");
}
return 0;
}

10
programs/a5/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題5",
"description": "第10回の課題「簡易電卓」を繰り返し計算できるように変更したプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/a5.png"
},
"note": ""
}

BIN
programs/a5/main Executable file

Binary file not shown.

54
programs/a5/main.c Normal file
View File

@@ -0,0 +1,54 @@
#include <stdio.h>
#define ADD 1
#define SUB 2
#define MUL 3
#define DIV 4
int main(void) {
double a, b;
int op;
int retry = 1;
do {
printf("Input first number: ");
scanf("%lf", &a);
printf("Input second number: ");
scanf("%lf", &b);
printf("Select Operation:\n"
"[1]: Addition\n"
"[2]: Subtraction\n"
"[3]: Multiplication\n"
"[4]: Division\n"
"> ");
scanf("%d", &op);
switch (op) {
case ADD:
printf("ANS: %lf\n", a + b);
break;
case SUB:
printf("ANS: %lf\n", a - b);
break;
case MUL:
printf("ANS: %lf\n", a * b);
break;
case DIV:
if (b == 0.0) {
puts("Zero Division");
return 1;
}
printf("ANS: %lf\n", a / b);
break;
default:
puts("Undefined Operation");
return 1;
}
printf("Retry? [1/0]: ");
scanf("%d", &retry);
} while (retry == 1);
return 0;
}

View File

@@ -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_float,
title = {Standard library header <float.h>},
author = {cppreference},
url = {https://en.cppreference.com/w/c/header/float.html},
urldate = {2025-06-26}
}

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}