wrote most of report
This commit is contained in:
BIN
assets/prog1.png
Normal file
BIN
assets/prog1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
BIN
assets/prog2.png
Normal file
BIN
assets/prog2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -1,18 +1,18 @@
|
|||||||
doc_class: nitreport
|
doc_class: nitreport
|
||||||
|
|
||||||
title: Insert Title Here
|
title: 第3回課題
|
||||||
author:
|
author:
|
||||||
name: 高専 太郎
|
name: 柴田 健琉
|
||||||
student_id: 0000-01
|
student_id: 15(2年生)
|
||||||
date:
|
date:
|
||||||
year: 令和7年
|
year: 令和7年
|
||||||
month: aa月
|
month: 04月
|
||||||
day: bb日
|
day: 27日
|
||||||
|
|
||||||
school_name: abc高専
|
school_name: 岐阜工業高等専門学校
|
||||||
department: 一般科
|
department: 電子制御工学科
|
||||||
subject: 〇〇概論
|
subject: 情報処理I
|
||||||
professor: □□教員
|
professor: 岡崎 憲一
|
||||||
|
|
||||||
page_config:
|
page_config:
|
||||||
include_cover_page: true
|
include_cover_page: true
|
||||||
@@ -21,6 +21,7 @@ page_config:
|
|||||||
show_compiled_time: true
|
show_compiled_time: true
|
||||||
|
|
||||||
sections:
|
sections:
|
||||||
- { path: 'section/introduction.tex', newpg: true }
|
- { path: 'section/introduction.tex', newpg: false }
|
||||||
- { path: 'md-out/test.tex', newpg: false }
|
- { path: 'section/syntax.tex', newpg: true }
|
||||||
|
- { path: 'section/prog1.tex', newpg: true }
|
||||||
|
- { path: 'section/prog2.tex', newpg: true }
|
||||||
|
|||||||
37
main.tex
Normal file
37
main.tex
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
\documentclass{class/nitreport}
|
||||||
|
|
||||||
|
\reporttitle{第3回課題}
|
||||||
|
\reportauthor{柴田 健琉}
|
||||||
|
\studentid{15(2年生)}
|
||||||
|
\reportdate{令和7年}{04月}{27日}
|
||||||
|
\schoolname{岐阜工業高等専門学校}
|
||||||
|
\department{電子制御工学科}
|
||||||
|
\subject{情報処理I}
|
||||||
|
\professor{岡崎 憲一}
|
||||||
|
|
||||||
|
\usepackage{ascmac}
|
||||||
|
|
||||||
|
\pagenumbering{roman}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\coverpage
|
||||||
|
|
||||||
|
\tableofcontents
|
||||||
|
\newpage
|
||||||
|
\pagenumbering{arabic}
|
||||||
|
|
||||||
|
\input{section/introduction.tex}
|
||||||
|
|
||||||
|
\input{section/syntax.tex}
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\input{section/prog1.tex}
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\input{section/prog2.tex}
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\printbibliography
|
||||||
|
|
||||||
|
\compiledTime
|
||||||
|
\end{document}
|
||||||
BIN
output/main-opt-final.pdf
Normal file
BIN
output/main-opt-final.pdf
Normal file
Binary file not shown.
BIN
output/main.pdf
Normal file
BIN
output/main.pdf
Normal file
Binary file not shown.
9
programs/prog1/info.json
Normal file
9
programs/prog1/info.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "演習1ー5",
|
||||||
|
"description": "プロンプトから読み込んだ整数値に13を加えた値を表示するプログラム。",
|
||||||
|
"output": {
|
||||||
|
"type": "screenshot",
|
||||||
|
"content": "./assets/prog1.png"
|
||||||
|
},
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
BIN
programs/prog1/main
Executable file
BIN
programs/prog1/main
Executable file
Binary file not shown.
12
programs/prog1/main.c
Normal file
12
programs/prog1/main.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
printf("Input integer: x = ");
|
||||||
|
scanf("%d", &x);
|
||||||
|
|
||||||
|
printf("Result: x + 13 = %d\n", x + 13);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
programs/prog2/info.json
Normal file
9
programs/prog2/info.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "演習1ー6",
|
||||||
|
"description": "プロンプトから読み込んだ整数値から7を減じた値を表示するプログラム。",
|
||||||
|
"output": {
|
||||||
|
"type": "screenshot",
|
||||||
|
"content": "./assets/prog2.png"
|
||||||
|
},
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
BIN
programs/prog2/main
Executable file
BIN
programs/prog2/main
Executable file
Binary file not shown.
12
programs/prog2/main.c
Normal file
12
programs/prog2/main.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
printf("Input integer: x = ");
|
||||||
|
scanf("%d", &x);
|
||||||
|
|
||||||
|
printf("Result: x - 7 = %d\n", x - 7);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
@online{example,
|
@online{cppref_scanf,
|
||||||
title = {Example Entry},
|
title = {scanf, fscanf, sscanf, scanf\_s, fscanf\_s, sscanf\_s},
|
||||||
author = {Inc., Example},
|
author = {Eendy and P12bot and P12 and Cubbi and Newatthis and Himanshujha199640 and LittleFlower and D41D8CD98F and Mission, Space},
|
||||||
organization = {Example, Inc.},
|
url = {https://en.cppreference.com/w/c/io/fscanf},
|
||||||
url = {https://www.example.com},
|
year = {2022},
|
||||||
year = {1970},
|
month = {07},
|
||||||
month = {01},
|
urldate = {2025-04-24}
|
||||||
urldate = {1970-01-01}
|
}
|
||||||
|
@online{cppref_stdio,
|
||||||
|
title = {Standard library header <stdio.h>},
|
||||||
|
author = {Mission, Space},
|
||||||
|
url = {https://en.cppreference.com/w/c/header/stdio},
|
||||||
|
year = {2025},
|
||||||
|
month = {02},
|
||||||
|
urldate = {2025-04-27}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function writeSection () {
|
|||||||
local x=0
|
local x=0
|
||||||
local res=""
|
local res=""
|
||||||
|
|
||||||
[[ $note == "\n\nnull" ]] && note=""
|
[[ $note == "\n\nnull" || $note == "\n\n" ]] && note=""
|
||||||
|
|
||||||
res+="\\section{$sectionName}\n\n$description\n\n\\subsection{コードリスティング}\n\n"
|
res+="\\section{$sectionName}\n\n$description\n\n\\subsection{コードリスティング}\n\n"
|
||||||
|
|
||||||
@@ -64,6 +64,8 @@ function writeSection () {
|
|||||||
x=$(($x+1))
|
x=$(($x+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
res+="\n\\section{実行結果}\n"
|
||||||
|
|
||||||
if [[ $outType == "screenshot" ]]; then
|
if [[ $outType == "screenshot" ]]; then
|
||||||
res+="\n\\\\begin{center}\n \\includegraphics[width=\\\\textwidth]{$outContent}\n\\\\end{center}"
|
res+="\n\\\\begin{center}\n \\includegraphics[width=\\\\textwidth]{$outContent}\n\\\\end{center}"
|
||||||
elif [[ $outType == "text" ]]; then
|
elif [[ $outType == "text" ]]; then
|
||||||
|
|||||||
@@ -1,67 +1,12 @@
|
|||||||
\section{はじめに}
|
\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 <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}
|
\begin{itemize}
|
||||||
\item C
|
\item OS: Arch Linux
|
||||||
\item Python
|
\item CPU アーキテクチャ: \texttt{x86\_64}
|
||||||
\item Javascript
|
\item C コンパイラ: \texttt{gcc (GCC) 14.2.1 20250207}
|
||||||
\item Rust
|
\item C コンパイラフラグ: \texttt{-Wall <ソースコード名> -o <プログラム名>}
|
||||||
\item Haskell
|
|
||||||
\end{itemize}
|
\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/prog1.tex
Normal file
13
section/prog1.tex
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
\section{演習1ー5}
|
||||||
|
|
||||||
|
プロンプトから読み込んだ整数値に13を加えた値を表示するプログラム。
|
||||||
|
|
||||||
|
\subsection{コードリスティング}
|
||||||
|
\defaultlistingstyle
|
||||||
|
\lstinputlisting[language=C,title={演習1ー5}]{../programs/prog1/main.c}
|
||||||
|
|
||||||
|
\subsection{実行結果}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/prog1.png}
|
||||||
|
\end{center}
|
||||||
13
section/prog2.tex
Normal file
13
section/prog2.tex
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
\section{演習1ー6}
|
||||||
|
|
||||||
|
プロンプトから読み込んだ整数値から7を減じた値を表示するプログラム。
|
||||||
|
|
||||||
|
\subsection{コードリスティング}
|
||||||
|
\defaultlistingstyle
|
||||||
|
\lstinputlisting[language=C,title={演習1ー6}]{../programs/prog2/main.c}
|
||||||
|
|
||||||
|
\subsection{実行結果}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/prog2.png}
|
||||||
|
\end{center}
|
||||||
32
section/syntax.tex
Normal file
32
section/syntax.tex
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
\section{今回の構文}
|
||||||
|
|
||||||
|
\subsection{\texttt{scanf}関数}
|
||||||
|
|
||||||
|
\texttt{scanf}関数は標準入力から文字列を読み取り、指定された書式に沿って解釈し、解釈結果の値を指定された場所に保存する。
|
||||||
|
ここでいう場所とは変数のアドレスのことである。
|
||||||
|
書式は\texttt{printf}関数と同じものである。\cite{cppref_scanf}
|
||||||
|
|
||||||
|
\defaultlistingstyle
|
||||||
|
\begin{lstlisting}[language=C,title={\texttt{scanf}関数}]
|
||||||
|
scanf("<書式>", <変数1へのアドレス>, <変数2へのアドレス>, ...);
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
\begin{itembox}[l]{\textrm{コラム:標準入出力関数の戻り値}}
|
||||||
|
標準入出力関数には\texttt{void}型を返す関数はほとんど定義されていない。
|
||||||
|
|
||||||
|
\vspace{0.25cm}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
表1:主な標準入出力関数の戻り値\cite{cppref_stdio}
|
||||||
|
|
||||||
|
\vspace{0.125cm}
|
||||||
|
|
||||||
|
\begin{tabular}{|ccl|}
|
||||||
|
\hline
|
||||||
|
関数 & 型 & \multicolumn{1}{c|}{概要} \\ \hline \hline
|
||||||
|
\texttt{scanf}系 & \texttt{int} & 正常に読み込まれた変数の数、0または\texttt{EOF}定数はエラーとなる \\ \hline
|
||||||
|
\texttt{printf}系 & \texttt{int} & \vtop{\hbox{\strut バッファーやストリームに書き込まれた文字の数、}\hbox{\strut 負の値はエラーとなる}} \\ \hline
|
||||||
|
\vtop{\hbox{\strut \texttt{setbuf, rewind,}} \hbox{\strut \texttt{clearerr, perror}}} & \texttt{void} & \vtop{\hbox{\strut これらの関数のみ値を返さない、}\hbox{\strut エラーになり得る処理ではないから}} \\ \hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{center}
|
||||||
|
\end{itembox}
|
||||||
Reference in New Issue
Block a user