There was a left over.

This commit is contained in:
2025-05-11 00:54:05 +09:00
parent f12d0bbc49
commit 2fe2e31cf7
9 changed files with 45 additions and 1 deletions

BIN
assets/abs-floating.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -39,5 +39,6 @@ sections:
- { path: 'section/lst36.tex', newpg: true }
- { path: 'section/lst37.tex', newpg: true }
- { path: 'section/lst38.tex', newpg: true }
- { path: 'section/abs.tex', newpg: false }
- { path: 'section/abs.tex', newpg: true }
- { path: 'section/abs-floating.tex', newpg: false }

View File

@@ -44,6 +44,9 @@
\newpage
\input{section/abs.tex}
\newpage
\input{section/abs-floating.tex}
\compiledTime
\end{document}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "演習課題2 浮動小数点数版",
"description": "倍精度浮動小数点数を読み込み、その絶対値を出力するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/abs-floating.png"
},
"note": ""
}

BIN
programs/abs-floating/main Executable file

Binary file not shown.

View File

@@ -0,0 +1,17 @@
#include <stdio.h>
int main(void) {
double x, y;
printf("Input floating point: ");
scanf("%lf", &x);
y = x;
if (y < 0.0)
y = -y;
printf("Absolute value of %lf is %lf.\n", x, y);
return 0;
}

13
section/abs-floating.tex Normal file
View File

@@ -0,0 +1,13 @@
\section{演習課題2 浮動小数点数版}
倍精度浮動小数点数を読み込み、その絶対値を出力するプログラム。
\subsection{コードリスティング}
\lstinputlisting[language=C,title={演習課題2 浮動小数点数版}]{../programs/abs-floating/main.c}
\subsection{実行結果}
\begin{center}
\includegraphics[width=\textwidth]{./assets/abs-floating.png}
\end{center}