draft
2
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))
|
||||
|
||||
|
||||
BIN
assets/p410.png
Normal file
|
After Width: | Height: | Size: 860 KiB |
BIN
assets/p411.png
Normal file
|
After Width: | Height: | Size: 655 KiB |
BIN
assets/p412.png
Normal file
|
After Width: | Height: | Size: 545 KiB |
BIN
assets/p45.png
Normal file
|
After Width: | Height: | Size: 655 KiB |
BIN
assets/p46.png
Normal file
|
After Width: | Height: | Size: 697 KiB |
BIN
assets/p47.png
Normal file
|
After Width: | Height: | Size: 691 KiB |
BIN
assets/p48.png
Normal file
|
After Width: | Height: | Size: 691 KiB |
BIN
assets/p49.png
Normal file
|
After Width: | Height: | Size: 689 KiB |
@@ -1,28 +1,28 @@
|
||||
doc_class: nitreport
|
||||
|
||||
title: Insert Title Here
|
||||
title: 第13回課題
|
||||
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: 10日
|
||||
turnin:
|
||||
year: 令和7年
|
||||
month: cc月
|
||||
day: dd日
|
||||
month: 07月
|
||||
day: 10日
|
||||
|
||||
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,14 @@ 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: false }
|
||||
- { path: 'section/p45', newpg: true }
|
||||
- { path: 'section/p46', newpg: true }
|
||||
- { path: 'section/p47', newpg: true }
|
||||
- { path: 'section/p48', newpg: true }
|
||||
- { path: 'section/p49', newpg: true }
|
||||
- { path: 'section/p410', newpg: true }
|
||||
- { path: 'section/p411', newpg: true }
|
||||
- { path: 'section/p412', newpg: true }
|
||||
|
||||
|
||||
54
main.tex
Normal file
@@ -0,0 +1,54 @@
|
||||
\documentclass{class/nitreport}
|
||||
|
||||
\reporttitle{第13回課題}
|
||||
\reportauthor{柴田 健琉}
|
||||
\studentid{2024D14}
|
||||
\seatingnum{15}
|
||||
\reportdate{令和7年}{07月}{10日}
|
||||
\turnindate{令和7年}{07月}{10日}
|
||||
\schoolname{岐阜工業高等専門学校}
|
||||
\department{電子制御工学科}
|
||||
\subject{情報処理I}
|
||||
\professor{岡崎 憲一}
|
||||
|
||||
\pagenumbering{roman}
|
||||
|
||||
\begin{document}
|
||||
\coverpage
|
||||
|
||||
\tableofcontents
|
||||
\newpage
|
||||
\pagenumbering{arabic}
|
||||
|
||||
\input{section/introduction.tex}
|
||||
|
||||
\input{section/syntax.tex}
|
||||
|
||||
\input{section/p45}
|
||||
\newpage
|
||||
|
||||
\input{section/p46}
|
||||
\newpage
|
||||
|
||||
\input{section/p47}
|
||||
\newpage
|
||||
|
||||
\input{section/p48}
|
||||
\newpage
|
||||
|
||||
\input{section/p49}
|
||||
\newpage
|
||||
|
||||
\input{section/p410}
|
||||
\newpage
|
||||
|
||||
\input{section/p411}
|
||||
\newpage
|
||||
|
||||
\input{section/p412}
|
||||
\newpage
|
||||
|
||||
\printbibliography[heading=bibintoc,title={参考文献}]
|
||||
|
||||
\compiledTime
|
||||
\end{document}
|
||||
@@ -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
10
programs/p410/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-10",
|
||||
"description": "入力した整数値の個数分縦にアスタリスクを表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p410.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p410/main
Executable file
21
programs/p410/main.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n < 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (n-- > 0) {
|
||||
putchar('*');
|
||||
if (n != 0) {
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p411/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-11",
|
||||
"description": "教科書のList 4-10の出力に入力値も表示するように変更したプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p411.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p411/main
Executable file
23
programs/p411/main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
do {
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
if (n <= 0) {
|
||||
puts("\aPlease input non-negative, non-zero integer.");
|
||||
}
|
||||
} while (n <= 0);
|
||||
|
||||
printf("Reverse of %d is ", n);
|
||||
while (n > 0) {
|
||||
printf("%d", n % 10);
|
||||
n /= 10;
|
||||
}
|
||||
|
||||
puts(".");
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p412/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-12",
|
||||
"description": "入力した正の整数値の桁数を表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p412.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p412/main
Executable file
24
programs/p412/main.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
do {
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
if (n <= 0) {
|
||||
puts("\aPlease input non-negative, non-zero integer.");
|
||||
}
|
||||
} while (n <= 0);
|
||||
|
||||
int d = 0;
|
||||
int x = n;
|
||||
while (x > 0) {
|
||||
x /= 10;
|
||||
d++;
|
||||
}
|
||||
|
||||
printf("%d is %d digit number.\n", n, d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p45/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-5",
|
||||
"description": "教科書のList 4-7のスタートを0から1へ書き換えたプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p45.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p45/main
Executable file
21
programs/p45/main.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i = 1;
|
||||
|
||||
while (i <= n) {
|
||||
printf("%d ", i++);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p46/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-6",
|
||||
"description": "入力した整数値以下の偶数を出力するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p46.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p46/main
Executable file
22
programs/p46/main.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n <= 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i = 1;
|
||||
|
||||
while (2*i <= n) {
|
||||
printf("%d ", 2*i++);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p47/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-7",
|
||||
"description": "入力した整数値以下の2のべき乗を出力するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p47.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p47/main
Executable file
23
programs/p47/main.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n <= 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i = 2;
|
||||
|
||||
while (i <= n) {
|
||||
printf("%d ", i);
|
||||
i <<= 1;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p48/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-8",
|
||||
"description": "教科書のList 4-8を1未満の時に改行を出力しないよにしたプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p48.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p48/main
Executable file
20
programs/p48/main.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n < 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (n-- > 0) {
|
||||
putchar('*');
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
10
programs/p49/info.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"language": "C",
|
||||
"name": "演習 4-9",
|
||||
"description": "入力した整数値の個数分$+$と$-$を交互に出力するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/p49.png"
|
||||
},
|
||||
"note": ""
|
||||
}
|
||||
BIN
programs/p49/main
Executable file
27
programs/p49/main.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Input positive integer: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
if (n <= 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
while (i < n) {
|
||||
if (i % 2) {
|
||||
putchar('-');
|
||||
} else {
|
||||
putchar('+');
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -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 = {putchar},
|
||||
author = {cppreference},
|
||||
url = {https://en.cppreference.com/w/c/io/putchar},
|
||||
urldate = {2025-07-10}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
13
section/p410.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-10}
|
||||
|
||||
入力した整数値の個数分縦にアスタリスクを表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-10}]{../programs/p410/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p410.png}
|
||||
\end{center}
|
||||
13
section/p411.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-11}
|
||||
|
||||
教科書のList 4-10の出力に入力値も表示するように変更したプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-11}]{../programs/p411/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p411.png}
|
||||
\end{center}
|
||||
13
section/p412.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-12}
|
||||
|
||||
入力した正の整数値の桁数を表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-12}]{../programs/p412/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p412.png}
|
||||
\end{center}
|
||||
13
section/p45.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-5}
|
||||
|
||||
教科書のList 4-7のスタートを0から1へ書き換えたプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-5}]{../programs/p45/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p45.png}
|
||||
\end{center}
|
||||
13
section/p46.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-6}
|
||||
|
||||
入力した整数値以下の偶数を出力するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-6}]{../programs/p46/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p46.png}
|
||||
\end{center}
|
||||
13
section/p47.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-7}
|
||||
|
||||
入力した整数値以下の2のべき乗を出力するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-7}]{../programs/p47/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p47.png}
|
||||
\end{center}
|
||||
13
section/p48.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-8}
|
||||
|
||||
教科書のList 4-8を1未満の時に改行を出力しないよにしたプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-8}]{../programs/p48/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p48.png}
|
||||
\end{center}
|
||||
13
section/p49.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-9}
|
||||
|
||||
入力した整数値の個数分$+$と$-$を交互に出力するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-9}]{../programs/p49/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p49.png}
|
||||
\end{center}
|
||||
34
section/syntax.tex
Normal file
@@ -0,0 +1,34 @@
|
||||
\section{今回の構文}
|
||||
|
||||
\subsection{\texttt{putchar}関数}
|
||||
|
||||
\texttt{putchar}関数は標準出力に引数で渡した文字(または整数表現の文字コード)を書き込む関数である。
|
||||
引数は関数内部で\texttt{unsigned char}型に変換される。\cite{cppref}
|
||||
|
||||
\defaultlistingstyle
|
||||
\begin{lstlisting}[language=C,title={\texttt{putchar}関数}]
|
||||
putchar('a'); // "a" が出力される
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection{\texttt{break}・\texttt{continue}文}
|
||||
|
||||
\texttt{break}・\texttt{continue}文はループ内で処理を中断・スキップする処理を記述する文である。
|
||||
\texttt{goto}文ともに、濫用するとコードが読みにくくなるので注意が必要である。
|
||||
|
||||
\defaultlistingstyle
|
||||
\begin{lstlisting}[language=C,title={\texttt{break}・\texttt{continue}文}]
|
||||
int i = 0;
|
||||
while (i < 10) {
|
||||
if (i % 3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i == 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%d ", i++);
|
||||
}
|
||||
|
||||
// 出力:0 1 2 4 5 7
|
||||
\end{lstlisting}
|
||||