From 8912215a06c0a3f63bf88829721ad43d69d90ec5 Mon Sep 17 00:00:00 2001 From: Kenryu Shibata Date: Thu, 8 May 2025 00:28:02 +0900 Subject: [PATCH] started assignment and added programs --- README.md | 3 +- document.yaml | 31 ++++++++++-------- markdown/test.md | 18 ----------- programs/comp/info.json | 10 ++++++ programs/comp/main.c | 16 ++++++++++ programs/p25/info.json | 10 ++++++ programs/p25/main.c | 14 ++++++++ programs/p26/info.json | 10 ++++++ programs/p26/main.c | 12 +++++++ section/comp.tex | 13 ++++++++ section/introduction.tex | 69 ---------------------------------------- section/p25.tex | 13 ++++++++ section/p26.tex | 13 ++++++++ section/syntax.tex | 0 14 files changed, 130 insertions(+), 102 deletions(-) delete mode 100644 markdown/test.md create mode 100644 programs/comp/info.json create mode 100644 programs/comp/main.c create mode 100644 programs/p25/info.json create mode 100644 programs/p25/main.c create mode 100644 programs/p26/info.json create mode 100644 programs/p26/main.c create mode 100644 section/comp.tex create mode 100644 section/p25.tex create mode 100644 section/p26.tex create mode 100644 section/syntax.tex diff --git a/README.md b/README.md index 03caad5..8bb25e4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# CHANGEME +# information-processing-1_5th-class +5th class: Type Casting diff --git a/document.yaml b/document.yaml index c49334c..abae6f8 100644 --- a/document.yaml +++ b/document.yaml @@ -1,23 +1,23 @@ doc_class: nitreport -title: Insert Title Here +title: 第5回課題 author: - name: 高専 太郎 - student_id: 0000-01 - seating_number: 1 + name: 柴田 健琉 + student_id: 2024D14 + seating_number: 15 date: year: 令和7年 - month: aa月 - day: bb日 + month: 05月 + day: 08日 turnin: year: 令和7年 - month: cc月 - day: dd日 + month: 05月 + day: 12日 -school_name: abc高専 -department: 一般科 -subject: 〇〇概論 -professor: □□教員 +school_name: 岐阜工業高等専門学校 +department: 電子制御工学科 +subject: 情報処理I +professor: 岡崎 憲一 paper_config: include_cover_page: 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/p25.tex', newpg: true } + - { path: 'section/p26.tex', newpg: true } + - { path: 'section/comp.tex', newpg: true } 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/programs/comp/info.json b/programs/comp/info.json new file mode 100644 index 0000000..df8e9b6 --- /dev/null +++ b/programs/comp/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習課題2", + "description": "電卓とC言語での演算の違いを比較する。", + "output": { + "type": "screenshot", + "content": "./assets/comp.png" + }, + "note": "" +} diff --git a/programs/comp/main.c b/programs/comp/main.c new file mode 100644 index 0000000..6970735 --- /dev/null +++ b/programs/comp/main.c @@ -0,0 +1,16 @@ +#include + +// Using function macro cuz im lazy +#define CALC(T,E) printf("Result: %"#T"\n", E); + +int main(void) { + + CALC(.6f,(5/2+1.5/2)) + CALC(.6f,(((int)2.5+4.0)/5)) + CALC(d,((int)(1.5+3)/2)) + CALC(.6f,(4+2*(double)(6/4))) + CALC(.6f,((int)3.3/1.1+(double)2/4)) + + return 0; + +} diff --git a/programs/p25/info.json b/programs/p25/info.json new file mode 100644 index 0000000..31a22aa --- /dev/null +++ b/programs/p25/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習課題1 演習2ー5", + "description": "2つの整数値を読み込み、前者の値が後者の値の何%であるかを倍精度浮動小数点数として表示するプログラム。", + "output": { + "type": "screenshot", + "content": "./assets/p25.png" + }, + "note": "" +} diff --git a/programs/p25/main.c b/programs/p25/main.c new file mode 100644 index 0000000..b4ab6cb --- /dev/null +++ b/programs/p25/main.c @@ -0,0 +1,14 @@ +#include + +int main(void) { + int a, b; + + printf("Integer a: "); + scanf("%d", &a); + printf("Integer b: "); + scanf("%d", &b); + + printf("Value of a is %f%% of b.\n", (double)a / (double)b * 100.0); + + return 0; +} diff --git a/programs/p26/info.json b/programs/p26/info.json new file mode 100644 index 0000000..935d7ce --- /dev/null +++ b/programs/p26/info.json @@ -0,0 +1,10 @@ +{ + "language": "C", + "name": "演習課題1 演習2ー6", + "description": "身長を整数値として読み込み、標準体重を実数小数点以下1桁として表示するプログラム。なお標準体重は$0.9(height - 100)$で求めるものとする。", + "output": { + "type": "screenshot", + "content": "./assets/p26.png" + }, + "note": "" +} diff --git a/programs/p26/main.c b/programs/p26/main.c new file mode 100644 index 0000000..67afdc4 --- /dev/null +++ b/programs/p26/main.c @@ -0,0 +1,12 @@ +#include + +int main(void) { + int height; + + printf("Input your height in cm: "); + scanf("%d", &height); + + printf("Standard weight is %.1fkg.\n", 0.9 * (double)(height - 100)); + + return 0; +} diff --git a/section/comp.tex b/section/comp.tex new file mode 100644 index 0000000..43bbe58 --- /dev/null +++ b/section/comp.tex @@ -0,0 +1,13 @@ +\section{演習課題2} + +電卓とC言語での演算の違いを比較する。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習課題2}]{../programs/comp/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/comp.png} +\end{center} diff --git a/section/introduction.tex b/section/introduction.tex index 3386076..023e039 100644 --- a/section/introduction.tex +++ b/section/introduction.tex @@ -1,70 +1 @@ \section{はじめに} - -Start Writing! - -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 -\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/p25.tex b/section/p25.tex new file mode 100644 index 0000000..0e2f906 --- /dev/null +++ b/section/p25.tex @@ -0,0 +1,13 @@ +\section{演習課題1 演習2ー5} + +2つの整数値を読み込み、前者の値が後者の値の何%であるかを倍精度浮動小数点数として表示するプログラム。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習課題1 演習2ー5}]{../programs/p25/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p25.png} +\end{center} diff --git a/section/p26.tex b/section/p26.tex new file mode 100644 index 0000000..54ea8d4 --- /dev/null +++ b/section/p26.tex @@ -0,0 +1,13 @@ +\section{演習課題1 演習2ー6} + +身長を整数値として読み込み、標準体重を実数小数点以下1桁として表示するプログラム。なお標準体重は$0.9(height - 100)$で求めるものとする。 + +\subsection{コードリスティング} + +\lstinputlisting[language=C,title={演習課題1 演習2ー6}]{../programs/p26/main.c} + +\subsection{実行結果} + +\begin{center} + \includegraphics[width=\textwidth]{./assets/p26.png} +\end{center} diff --git a/section/syntax.tex b/section/syntax.tex new file mode 100644 index 0000000..e69de29