draft
This commit is contained in:
@@ -1,70 +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!}
|
||||
|
||||
\noindent
|
||||
この行のテキストは四十二字です。ああああああああああああああああああああああああああいいいい
|
||||
|
||||
\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}
|
||||
\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/p410.tex
Normal file
13
section/p410.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-10}
|
||||
|
||||
入力した整数値の個数分縦にアスタリスクを表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-10}]{../programs/p410/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p410.png}
|
||||
\end{center}
|
||||
13
section/p411.tex
Normal file
13
section/p411.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-11}
|
||||
|
||||
教科書のList 4-10の出力に入力値も表示するように変更したプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-11}]{../programs/p411/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p411.png}
|
||||
\end{center}
|
||||
13
section/p412.tex
Normal file
13
section/p412.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-12}
|
||||
|
||||
入力した正の整数値の桁数を表示するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-12}]{../programs/p412/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p412.png}
|
||||
\end{center}
|
||||
13
section/p45.tex
Normal file
13
section/p45.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-5}
|
||||
|
||||
教科書のList 4-7のスタートを0から1へ書き換えたプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-5}]{../programs/p45/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p45.png}
|
||||
\end{center}
|
||||
13
section/p46.tex
Normal file
13
section/p46.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-6}
|
||||
|
||||
入力した整数値以下の偶数を出力するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-6}]{../programs/p46/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p46.png}
|
||||
\end{center}
|
||||
13
section/p47.tex
Normal file
13
section/p47.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-7}
|
||||
|
||||
入力した整数値以下の2のべき乗を出力するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-7}]{../programs/p47/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p47.png}
|
||||
\end{center}
|
||||
13
section/p48.tex
Normal file
13
section/p48.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-8}
|
||||
|
||||
教科書のList 4-8を1未満の時に改行を出力しないよにしたプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-8}]{../programs/p48/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p48.png}
|
||||
\end{center}
|
||||
13
section/p49.tex
Normal file
13
section/p49.tex
Normal file
@@ -0,0 +1,13 @@
|
||||
\section{演習 4-9}
|
||||
|
||||
入力した整数値の個数分$+$と$-$を交互に出力するプログラム。
|
||||
|
||||
\subsection{コードリスティング}
|
||||
|
||||
\lstinputlisting[language=C,title={演習 4-9}]{../programs/p49/main.c}
|
||||
|
||||
\subsection{実行結果}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{./assets/p49.png}
|
||||
\end{center}
|
||||
34
section/syntax.tex
Normal file
34
section/syntax.tex
Normal file
@@ -0,0 +1,34 @@
|
||||
\section{今回の構文}
|
||||
|
||||
\subsection{\texttt{putchar}関数}
|
||||
|
||||
\texttt{putchar}関数は標準出力に引数で渡した文字(または整数表現の文字コード)を書き込む関数である。
|
||||
引数は関数内部で\texttt{unsigned char}型に変換される。\cite{cppref}
|
||||
|
||||
\defaultlistingstyle
|
||||
\begin{lstlisting}[language=C,title={\texttt{putchar}関数}]
|
||||
putchar('a'); // "a" が出力される
|
||||
\end{lstlisting}
|
||||
|
||||
\subsection{\texttt{break}・\texttt{continue}文}
|
||||
|
||||
\texttt{break}・\texttt{continue}文はループ内で処理を中断・スキップする処理を記述する文である。
|
||||
\texttt{goto}文ともに、濫用するとコードが読みにくくなるので注意が必要である。
|
||||
|
||||
\defaultlistingstyle
|
||||
\begin{lstlisting}[language=C,title={\texttt{break}・\texttt{continue}文}]
|
||||
int i = 0;
|
||||
while (i < 10) {
|
||||
if (i % 3) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i == 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%d ", i++);
|
||||
}
|
||||
|
||||
// 出力:0 1 2 4 5 7
|
||||
\end{lstlisting}
|
||||
Reference in New Issue
Block a user