Finished first group of assignments
This commit is contained in:
BIN
assets/lst22.png
Normal file
BIN
assets/lst22.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/prog1.png
Normal file
BIN
assets/prog1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/prog2.png
Normal file
BIN
assets/prog2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/rev3dig.png
Normal file
BIN
assets/rev3dig.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
@@ -1,23 +1,23 @@
|
||||
doc_class: nitreport
|
||||
|
||||
title: Insert Title Here
|
||||
title: 第4回課題
|
||||
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: 01日
|
||||
turnin:
|
||||
year: 令和7年
|
||||
month: cc月
|
||||
day: dd日
|
||||
month: 05月
|
||||
day: 04日
|
||||
|
||||
school_name: abc高専
|
||||
department: 一般科
|
||||
subject: 〇〇概論
|
||||
professor: □□教員
|
||||
school_name: 岐阜工業高等専門学校
|
||||
department: 電子制御工学科
|
||||
subject: 情報処理I
|
||||
professor: 岡崎 憲一教員
|
||||
|
||||
page_config:
|
||||
include_cover_page: true
|
||||
@@ -31,5 +31,8 @@ page_config:
|
||||
|
||||
sections:
|
||||
- { path: 'section/introduction.tex', newpg: true }
|
||||
- { path: 'md-out/test.tex', newpg: false }
|
||||
- { path: 'section/prog1.tex', newpg: true }
|
||||
- { path: 'section/prog2.tex', newpg: true }
|
||||
- { path: 'section/lst22.tex', newpg: true }
|
||||
- { path: 'section/rev3dig.tex', newpg: true }
|
||||
|
||||
|
||||
41
main.tex
Normal file
41
main.tex
Normal file
@@ -0,0 +1,41 @@
|
||||
\documentclass{class/nitreport}
|
||||
|
||||
\reporttitle{第4回課題}
|
||||
\reportauthor{柴田 健琉}
|
||||
\studentid{2024D14}
|
||||
\seatingnum{15}
|
||||
\reportdate{令和7年}{05月}{01日}
|
||||
\turnindate{令和7年}{05月}{04日}
|
||||
\schoolname{岐阜工業高等専門学校}
|
||||
\department{電子制御工学科}
|
||||
\subject{情報処理I}
|
||||
\professor{岡崎 憲一教員}
|
||||
|
||||
\pagenumbering{roman}
|
||||
|
||||
\begin{document}
|
||||
\coverpage
|
||||
|
||||
\tableofcontents
|
||||
\newpage
|
||||
\pagenumbering{arabic}
|
||||
|
||||
\input{section/introduction.tex}
|
||||
\newpage
|
||||
|
||||
\input{section/prog1.tex}
|
||||
\newpage
|
||||
|
||||
\input{section/prog2.tex}
|
||||
\newpage
|
||||
|
||||
\input{section/lst22.tex}
|
||||
\newpage
|
||||
|
||||
\input{section/rev3dig.tex}
|
||||
\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-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.
8
programs/lst22/info.json
Normal file
8
programs/lst22/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "List 2ー2 +$\\\\alpha$",
|
||||
"description": "2桁以上の正の整数の十の位の数字を表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/lst22.png"
|
||||
}
|
||||
}
|
||||
BIN
programs/lst22/main
Executable file
BIN
programs/lst22/main
Executable file
Binary file not shown.
18
programs/lst22/main.c
Normal file
18
programs/lst22/main.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Integer n: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
// Don't trust user input
|
||||
if (n < 10) {
|
||||
printf("Integer n must be more than 2 digits.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Tens digit of interger n is %d.", n / 10 % 10);
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
programs/prog1/info.json
Normal file
8
programs/prog1/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "演習 2ー1",
|
||||
"description": "2つの整数値を読み込み、前者の値が後者の何\\%であるかを表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/prog1.png"
|
||||
}
|
||||
}
|
||||
BIN
programs/prog1/main
Executable file
BIN
programs/prog1/main
Executable file
Binary file not shown.
15
programs/prog1/main.c
Normal file
15
programs/prog1/main.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int x;
|
||||
int y;
|
||||
|
||||
printf("Integer x: ");
|
||||
scanf("%d", &x);
|
||||
printf("Integer y: ");
|
||||
scanf("%d", &y);
|
||||
|
||||
printf("Value of x is %d%% of y.", x * 100 / y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
programs/prog2/info.json
Normal file
8
programs/prog2/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "演習 2ー2",
|
||||
"description": "2つの整数値を読み込み、それらの和と積を表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/prog2.png"
|
||||
}
|
||||
}
|
||||
BIN
programs/prog2/main
Executable file
BIN
programs/prog2/main
Executable file
Binary file not shown.
15
programs/prog2/main.c
Normal file
15
programs/prog2/main.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int a;
|
||||
int b;
|
||||
|
||||
printf("Integer a: ");
|
||||
scanf("%d", &a);
|
||||
printf("Integer b: ");
|
||||
scanf("%d", &b);
|
||||
|
||||
printf("Sum of two integers is %d, and product is %d.", a+b, a*b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
8
programs/rev3dig/info.json
Normal file
8
programs/rev3dig/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "課題4",
|
||||
"description": "入力した三桁の正の整数の数字の並びを逆順させた数字を表示するプログラム。",
|
||||
"output": {
|
||||
"type": "screenshot",
|
||||
"content": "./assets/rev3dig.png"
|
||||
}
|
||||
}
|
||||
BIN
programs/rev3dig/main
Executable file
BIN
programs/rev3dig/main
Executable file
Binary file not shown.
26
programs/rev3dig/main.c
Normal file
26
programs/rev3dig/main.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
|
||||
printf("Integer n: ");
|
||||
scanf("%d", &n);
|
||||
|
||||
// Throw error when n is not in range of 100 <= n <= 999
|
||||
if (n < 100 || n > 999) {
|
||||
printf("Integer n must be 3 digit number");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int a, b, c, m; // a * 10^2 + b * 10^1 + c * 10^0 = n
|
||||
|
||||
a = n / 100;
|
||||
b = n / 10 % 10;
|
||||
c = n % 10;
|
||||
|
||||
m = c * 100 + b * 10 + a; // m is reversed n
|
||||
|
||||
printf("Reversed integer is %d.", m);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,67 +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!}
|
||||
|
||||
\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 <ソースコード名> -o <プログラム名>}
|
||||
\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
|
||||
|
||||
14
section/lst22.tex
Normal file
14
section/lst22.tex
Normal file
@@ -0,0 +1,14 @@
|
||||
\section{List 2ー2 +$\alpha$}
|
||||
|
||||
2桁以上の正の整数の十の位の数字を表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\defaultlistingstyle
|
||||
\lstinputlisting[language=C,title={List 2ー2 +$\alpha$}]{../programs/lst22/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/lst22.png}
|
||||
\end{center}
|
||||
14
section/prog1.tex
Normal file
14
section/prog1.tex
Normal file
@@ -0,0 +1,14 @@
|
||||
\section{演習 2ー1}
|
||||
|
||||
2つの整数値を読み込み、前者の値が後者の何\%であるかを表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\defaultlistingstyle
|
||||
\lstinputlisting[language=C,title={演習 2ー1}]{../programs/prog1/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/prog1.png}
|
||||
\end{center}
|
||||
14
section/prog2.tex
Normal file
14
section/prog2.tex
Normal file
@@ -0,0 +1,14 @@
|
||||
\section{演習 2ー2}
|
||||
|
||||
2つの整数値を読み込み、それらの和と積を表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\defaultlistingstyle
|
||||
\lstinputlisting[language=C,title={演習 2ー2}]{../programs/prog2/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/prog2.png}
|
||||
\end{center}
|
||||
16
section/rev3dig.tex
Normal file
16
section/rev3dig.tex
Normal file
@@ -0,0 +1,16 @@
|
||||
\section{課題4}
|
||||
|
||||
入力した三桁の正の整数の数字の並びを逆順させた数字を表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\vspace{-0.5cm}
|
||||
|
||||
\defaultlistingstyle
|
||||
\lstinputlisting[language=C,title={課題4}]{../programs/rev3dig/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=12cm]{./assets/rev3dig.png}
|
||||
\end{center}
|
||||
0
section/syntax.tex
Normal file
0
section/syntax.tex
Normal file
Reference in New Issue
Block a user