-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsizes.cpp
114 lines (98 loc) · 2.4 KB
/
sizes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# include <cstdlib>
# include <iostream>
# include <ctime>
using namespace std;
int main ( int argc, char *argv[] );
void timestamp ( );
//****************************************************************************80
int main ( int argc, char *argv[] )
//****************************************************************************80
//
// Purpose:
//
// SIZES returns the size of various data types.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 02 March 2006
//
// Author:
//
// John Burkardt
//
{
timestamp ( );
cout << "\n";
cout << "SIZES\n";
cout << " C++ version\n";
cout << " Return the size of various data types.\n";
cout << "\n";
cout << " Compiled on " << __DATE__ << " at " << __TIME__ << "\n";
cout << "\n";
cout << " char " << sizeof ( char ) << " bytes.\n";
cout << "\n";
cout << " short int " << sizeof ( short int ) << " bytes.\n";
cout << " int " << sizeof ( int ) << " bytes.\n";
cout << " long int " << sizeof ( long int ) << " bytes.\n";
cout << "long long int " << sizeof ( long long int ) << " bytes.\n";
cout << "\n";
cout << " float " << sizeof ( float ) << " bytes.\n";
cout << " double " << sizeof ( double ) << " bytes.\n";
cout << " long double " << sizeof ( long double ) << " bytes.\n";
cout << "\n";
cout << " bool " << sizeof ( bool ) << " bytes.\n";
//
// Terminate.
//
cout << "\n";
cout << "SIZES\n";
cout << " Normal end of execution.\n";
cout << "\n";
timestamp ( );
return 0;
}
//****************************************************************************80
void timestamp ( )
//****************************************************************************80
//
// Purpose:
//
// TIMESTAMP prints the current YMDHMS date as a time stamp.
//
// Example:
//
// May 31 2001 09:45:54 AM
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 03 October 2003
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// None
//
{
# define TIME_SIZE 40
static char time_buffer[TIME_SIZE];
const struct tm *tm;
size_t len;
time_t now;
now = time ( NULL );
tm = localtime ( &now );
len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm );
cout << time_buffer << "\n";
return;
# undef TIME_SIZE
}