-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathweekday_prb.cpp
119 lines (104 loc) · 2.1 KB
/
weekday_prb.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
115
116
117
118
119
# include <cstdlib>
# include <iostream>
# include <iomanip>
# include <cstring>
using namespace std;
# include "weekday.hpp"
int main ( );
void test01 ( );
//****************************************************************************80
int main ( )
//****************************************************************************80
//
// Purpose:
//
// MAIN is the main program for WEEKDAY_PRB.
//
// Discussion:
//
// WEEKDAY_PRB tests the WEEKDAY library.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 25 March 2010
//
// Author:
//
// John Burkardt
//
{
timestamp ( );
cout << "\n";
cout << "WEEKDAY_PRB:\n";
cout << " C++ version\n";
cout << " Test the WEEKDAY library.\n";
test01 ( );
//
// Terminate.
//
cout << "\n";
cout << "WEEKDAY_PRB:\n";
cout << " Noraml end of execution.\n";
cout << "\n";
timestamp ( );
return 0;
}
//****************************************************************************80
void test01 ( )
//****************************************************************************80
//
// Purpose:
//
// TEST01 tests YMD_TO_WEEKDAY_COMMON.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 28 May 2012
//
// Author:
//
// John Burkardt
//
{
int d;
int m;
int n_data;
string s1;
string s2;
string s3;
int w1;
int w2;
int y;
cout << "\n";
cout << "TEST01\n";
cout << " For dates in the Common calendar:\n";
cout << " YMD_TO_WEEKDAY_COMMON returns the day of the week.\n";
cout << "\n";
cout << " YMD Weekday Weekday\n";
cout << " Tabulated Computed\n";
cout << "\n";
for ( ; ; )
{
weekday_values ( n_data, y, m, d, w1 );
if ( n_data == 0 )
{
break;
}
s3 = ymd_to_s_common ( y, m, d );
w2 = ymd_to_weekday_common ( y, m, d );
s1 = weekday_to_name_common ( w1 );
s2 = weekday_to_name_common ( w2 );
cout << " " << setw(20) << s3
<< " " << setw(9) << s1
<< " " << setw(9) << s2 << "\n";
}
return;
}