wrote most of report
This commit is contained in:
@@ -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 (GCC) 14.2.1 20250207}
|
||||
\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
|
||||
|
||||
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