Compare commits
4 Commits
6a2eaa43d8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f743ff8319 | |||
| 64c4a1af4d | |||
| 08b885e397 | |||
| 0805e15bb9 |
BIN
assets/lst22.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/printf-formats/main-p1-f.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
assets/printf-formats/main-p1-lf.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/printf-formats/main-p2-d.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
assets/printf-formats/main-p2-lf.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/printf-formats/main-s1-f.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
assets/printf-formats/main-s1-lf.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
assets/printf-formats/main-s2-d.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
assets/printf-formats/main-s2-f.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
assets/prog1.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/prog2.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/rev3dig.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
@@ -1,23 +1,23 @@
|
|||||||
doc_class: nitreport
|
doc_class: nitreport
|
||||||
|
|
||||||
title: Insert Title Here
|
title: 第4回課題
|
||||||
author:
|
author:
|
||||||
name: 高専 太郎
|
name: 柴田 健琉
|
||||||
student_id: 0000-01
|
student_id: 2024D14
|
||||||
seating_number: 1
|
seating_number: 15
|
||||||
date:
|
date:
|
||||||
year: 令和7年
|
year: 令和7年
|
||||||
month: aa月
|
month: 05月
|
||||||
day: bb日
|
day: 01日
|
||||||
turnin:
|
turnin:
|
||||||
year: 令和7年
|
year: 令和7年
|
||||||
month: cc月
|
month: 05月
|
||||||
day: dd日
|
day: 04日
|
||||||
|
|
||||||
school_name: abc高専
|
school_name: 岐阜工業高等専門学校
|
||||||
department: 一般科
|
department: 電子制御工学科
|
||||||
subject: 〇〇概論
|
subject: 情報処理I
|
||||||
professor: □□教員
|
professor: 岡崎 憲一教員
|
||||||
|
|
||||||
page_config:
|
page_config:
|
||||||
include_cover_page: true
|
include_cover_page: true
|
||||||
@@ -30,6 +30,11 @@ page_config:
|
|||||||
# - pkgs
|
# - pkgs
|
||||||
|
|
||||||
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 }
|
||||||
|
- { path: 'section/lst22.tex', newpg: true }
|
||||||
|
- { path: 'section/rev3dig.tex', newpg: true }
|
||||||
|
- { path: 'section/printf-formats.tex', newpg: false }
|
||||||
|
|
||||||
|
|||||||
47
main.tex
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
\documentclass{class/nitreport}
|
||||||
|
|
||||||
|
\reporttitle{第4回課題}
|
||||||
|
\reportauthor{柴田 健琉}
|
||||||
|
\studentid{2024D14}
|
||||||
|
\seatingnum{15}
|
||||||
|
\reportdate{令和7年}{05月}{01日}
|
||||||
|
\turnindate{令和7年}{05月}{04日}
|
||||||
|
\schoolname{岐阜工業高等専門学校}
|
||||||
|
\department{電子制御工学科}
|
||||||
|
\subject{情報処理I}
|
||||||
|
\professor{岡崎 憲一教員}
|
||||||
|
|
||||||
|
\usepackage[table,xcdraw]{xcolor}
|
||||||
|
|
||||||
|
\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
|
||||||
|
|
||||||
|
\input{section/lst22.tex}
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\input{section/rev3dig.tex}
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\input{section/printf-formats.tex}
|
||||||
|
|
||||||
|
\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.pdf
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-p1-f.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %f\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-p1-lf.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-p2-d.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %d\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-p2-lf.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %lf\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-s1-f.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%f", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-s1-lf.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%lf", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-s2-d.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%d", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main-s2-f.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%f", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
programs/printf-formats/main.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n;
|
||||||
|
double x;
|
||||||
|
|
||||||
|
printf("Int n: "); scanf("%d", &n);
|
||||||
|
printf("Double x: "); scanf("%lf", &x);
|
||||||
|
|
||||||
|
printf("Integer n is %d\n", n);
|
||||||
|
printf("Double percision floating point decimal x is %f\n", x);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
4
programs/printf-formats/test.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
10
|
||||||
|
25.3
|
||||||
|
|
||||||
|
|
||||||
8
programs/prog1/info.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "演習 2ー1",
|
||||||
|
"description": "2つの整数値を読み込み、前者の値が後者の何\\%であるかを表示するプログラム。",
|
||||||
|
"output": {
|
||||||
|
"type": "screenshot",
|
||||||
|
"content": "./assets/prog1.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
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
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "演習 2ー2",
|
||||||
|
"description": "2つの整数値を読み込み、それらの和と積を表示するプログラム。",
|
||||||
|
"output": {
|
||||||
|
"type": "screenshot",
|
||||||
|
"content": "./assets/prog2.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
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
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "課題4",
|
||||||
|
"description": "入力した三桁の正の整数の数字の並びを逆順させた数字を表示するプログラム。",
|
||||||
|
"output": {
|
||||||
|
"type": "screenshot",
|
||||||
|
"content": "./assets/rev3dig.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
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,13 @@
|
|||||||
\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 コンパイラ(5月1日付): \texttt{gcc バージョン 14.2.1 20250322 (GCC)}
|
||||||
\item Rust
|
\item C コンパイラ(5月4日付): \texttt{gcc バージョン 15.1.1 20250425 (GCC)}
|
||||||
\item Haskell
|
\item C コンパイラオプション: \texttt{-Wall <ソースコード名> -o <プログラム名>}
|
||||||
\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
|
|
||||||
|
|||||||
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}
|
||||||
97
section/printf-formats.tex
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
\section{\texttt{int}型・\texttt{double}型と\texttt{printf}関数・\texttt{scanf}関数の書式}
|
||||||
|
|
||||||
|
\defaultlistingstyle
|
||||||
|
\lstinputlisting[language=C, title={変更前のソースコード}]{../programs/printf-formats/main.c}
|
||||||
|
|
||||||
|
上記のソースコードについて、\texttt{printf}関数と\texttt{scanf}関数の書式を次のように変更していく:
|
||||||
|
|
||||||
|
\begin{table}[h]
|
||||||
|
\centering
|
||||||
|
\begin{tabular}{lc}
|
||||||
|
\hline
|
||||||
|
\multicolumn{1}{c}{概要} & 実行ファイル名 \\
|
||||||
|
\hline \hline
|
||||||
|
第一の\texttt{printf}関数の書式を\texttt{\%f}にする & \texttt{main-p1-f} \\
|
||||||
|
第一の\texttt{printf}関数の書式を\texttt{\%lf}にする & \texttt{main-p1-lf} \\
|
||||||
|
第二の\texttt{printf}関数の書式を\texttt{\%d}にする & \texttt{main-p2-d} \\
|
||||||
|
第二の\texttt{printf}関数の書式を\texttt{\%lf}にする & \texttt{main-p2-lf} \\
|
||||||
|
第一の\texttt{scanf}関数の書式を\texttt{\%f}にする & \texttt{main-s1-f} \\
|
||||||
|
第一の\texttt{scanf}関数の書式を\texttt{\%lf}にする & \texttt{main-s1-lf} \\
|
||||||
|
第二の\texttt{scanf}関数の書式を\texttt{\%d}にする & \texttt{main-s2-d} \\
|
||||||
|
第二の\texttt{scanf}関数の書式を\texttt{\%f}にする & \texttt{main-s2-f} \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{table}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-p1-f}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p1-f.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-p1-lf}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p1-lf.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-p2-d}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p2-d.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-p2-lf}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-p2-lf.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-s1-f}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s1-f.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-s1-lf}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s1-lf.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-s2-d}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s2-d.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\subsection{\texttt{main-s2-f}}
|
||||||
|
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth]{./assets/printf-formats/main-s2-f.png}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\newpage
|
||||||
|
|
||||||
|
\subsection{結果}
|
||||||
|
|
||||||
|
\begin{table}[h]
|
||||||
|
\caption{実行結果一覧(強調行は正常結果)}
|
||||||
|
\centering
|
||||||
|
\begin{tabular}{|ccc|}
|
||||||
|
\hline
|
||||||
|
実行ファイル名 & コンパイル警告の有無 & 意図的な結果であるか \\
|
||||||
|
\hline \hline
|
||||||
|
\texttt{main-p1-f} & 有 & 否 \\
|
||||||
|
\rowcolor[HTML]{FFC702}
|
||||||
|
\texttt{main-p1-lf} & 無 & 然 \\
|
||||||
|
\texttt{main-p2-d} & 有 & 否 \\
|
||||||
|
\rowcolor[HTML]{FFC702}
|
||||||
|
\texttt{main-p2-lf} & 無 & 然 \\
|
||||||
|
\texttt{main-s1-f} & 有 & 否 \\
|
||||||
|
\texttt{main-s1-lf} & 有 & 否 \\
|
||||||
|
\texttt{main-s2-d} & 有 & 否 \\
|
||||||
|
\texttt{main-s2-f} & 有 & 否 \\
|
||||||
|
\hline
|
||||||
|
\end{tabular}
|
||||||
|
\end{table}
|
||||||
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
@@ -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
@@ -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}
|
||||||
22
section/syntax.tex
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
\section{今回の構文}
|
||||||
|
|
||||||
|
\subsection{四則演算}
|
||||||
|
|
||||||
|
C言語での四則演算は以下の通りである:
|
||||||
|
|
||||||
|
\defaultlistingstyle
|
||||||
|
\begin{lstlisting}[language=C, title={四則演算}]
|
||||||
|
a + b; // 加算
|
||||||
|
a - b; // 減算
|
||||||
|
a * b; // 乗算
|
||||||
|
a / b; // 除算 a、b共に整数型だと演算結果は小数点以下切り捨てられた値となる
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
\subsection{剰余演算}
|
||||||
|
|
||||||
|
aをbで割った余りを求める剰余演算は以下の通りである:
|
||||||
|
|
||||||
|
\defaultlistingstyle
|
||||||
|
\begin{lstlisting}[language=C, title={剰余演算}]
|
||||||
|
a % b; // 剰余
|
||||||
|
\end{lstlisting}
|
||||||