CPP02
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
main.cpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* main.cpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/04/28 16:54:12 by kamitsui #+# #+# */
9
/* Updated: 2025/05/06 14:49:59 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
22
#include "
Fixed.hpp
"
23
#include <
iostream
>
24
26
int
main
(
void
) {
27
Fixed
a;
28
Fixed
const
b(10);
29
Fixed
const
c(42.42f);
30
Fixed
const
d(b);
31
a =
Fixed
(1234.4321f);
32
33
std::cout
<<
"a is "
<< a <<
std::endl
;
34
std::cout
<<
"b is "
<< b <<
std::endl
;
35
std::cout
<<
"c is "
<< c <<
std::endl
;
36
std::cout
<<
"d is "
<< d <<
std::endl
;
37
std::cout
<<
"a is "
<< a.
toInt
() <<
" as integer"
<<
std::endl
;
38
std::cout
<<
"b is "
<< b.
toInt
() <<
" as integer"
<<
std::endl
;
39
std::cout
<<
"c is "
<< c.
toInt
() <<
" as integer"
<<
std::endl
;
40
std::cout
<<
"d is "
<< d.
toInt
() <<
" as integer"
<<
std::endl
;
41
return
0;
42
}
iostream
std::endl
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
std::cout
ostream cout
Fixed
ex00 Fixed Class
Definition
Fixed.hpp:28
Fixed::toInt
int toInt(void) const
Converts the fixed-point value to an integer value (truncates the fractional part).
Definition
Fixed.cpp:101
main
int main(void)
Definition
main.cpp:25
Fixed.hpp
Header file for the Fixed class representing fixed-point numbers with overloaded operators and min/ma...
ex01
main.cpp
構築:
1.9.8