Home > Back-end >  C language program code programming problem
C language program code programming problem

Time:09-17

Create a calendar,
Input: the output of a whole year calendar
In title and input output of the current month calendar

CodePudding user response:

Formatted input (judgment is + months or years) - & gt; The following is not a leap year: - & gt; To generate a calendar in a 2 d array - & gt; According to the first output (circular array)

CodePudding user response:

reference 1/f, N - N - N response:
formatted input (judgment is + months or years) - & gt; The following is not a leap year: - & gt; To generate a calendar in a 2 d array - & gt; According to the first output (circular array)

Can probably give you a flow chart to see

CodePudding user response:

refer to the second floor weixin_48793683 response:
Quote: reference 1/f, N - N - N response:
formatted input (judgment is + months or years) - & gt; The following is not a leap year: - & gt; To generate a calendar in a 2 d array - & gt; According to the first output (circular array)

Can probably give you a flow chart to see

 
#include
Void SplitString (const string& S, vector & V, const string& C)
{
String: : size_type pos1, pos2;
Pos2=s. ind (c);
Pos1=0;
While (string: : npos!=pos2)
{
Valerie plame ush_back (s.s ubstr (pos1, pos2 - pos1));

C.s. considering pos1=pos2 + ();
Pos2=s. ind (c, pos1);
}
If (pos1!=s.l ength ())
Valerie plame ush_back (s.s ubstr (pos1));
}
.
Cout<" Input format yyyy - mm or yyyy ";
String f;
Int year;
Bool y=false;
Cin> f;
If (f.f ind (" - ")==balance pos) {//a month
Y=true;
} else {
Year=f;
}
Bool r=false;
If (year % 4==0 & amp; & Year % 100!=0 | | year % 400==0) b=true;//a leap year
Cout<

if(! Y) {
for(int i=1; i<=12; I++) {
CoutThe switch (I) {

Case 1:

Case 3:

Case 5:

Case 7:

Case 8:

Case 10:

Case 12:
For (int n=1; n<=31; Cout< n++); break;

Case 2:

If (r)

For (int n=1; n<=29; Cout< n++);
The else

For (int n=1; n<=28; Cout< n++);
break;

Case 4:

Case 6:

Case 9:

Case 11:

For (int n=1; n<=30; Cout< n++);
break;

}
}
}
If (y) {
Vector v;
SplitString (f, v, "-");
Year=v [0];
Int I=v [1];
The switch (I) {

Case 1:

Case 3:

Case 5:

Case 7:

Case 8:

Case 10:

Case 12:
For (int n=1; n<=31; Cout< n++); break;

Case 2:

If (r)

For (int n=1; n<=29; Cout< n++);
The else

For (int n=1; n<=28; Cout< n++);
break;

Case 4:

Case 6:

Case 9:

Case 11:

For (int n=1; n<=30; Cout< n++);
break;

}
}
return 0;


Refer to
https://zhidao.baidu.com/question/2201844490211422628.html
https://www.cnblogs.com/yuehouse/p/10230589.html

Literally write there may be a bug

CodePudding user response:

reference N - N - N reply: 3/f
Quote: refer to the second floor weixin_48793683 response:

Quote: reference 1/f, N - N - N response:
formatted input (judgment is + months or years) - & gt; The following is not a leap year: - & gt; To generate a calendar in a 2 d array - & gt; According to the first output (circular array)

Can probably give you a flow chart to see

 
#include
Void SplitString (const string& S, vector & V, const string& C)
{
String: : size_type pos1, pos2;
Pos2=s. ind (c);
Pos1=0;
While (string: : npos!=pos2)
{
Valerie plame ush_back (s.s ubstr (pos1, pos2 - pos1));

C.s. considering pos1=pos2 + ();
Pos2=s. ind (c, pos1);
}
If (pos1!=s.l ength ())
Valerie plame ush_back (s.s ubstr (pos1));
}
.
Cout<" Input format yyyy - mm or yyyy ";
String f;
Int year;
Bool y=false;
Cin> f;
If (f.f ind (" - ")==balance pos) {//a month
Y=true;
} else {
Year=f;
}
Bool r=false;
If (year % 4==0 & amp; & Year % 100!=0 | | year % 400==0) b=true;//a leap year
Cout<

if(! Y) {
for(int i=1; i<=12; I++) {
CoutThe switch (I) {

Case 1:

Case 3:

Case 5:

Case 7:

Case 8:

Case 10:

Case 12:
For (int n=1; n<=31; Cout< n++); break;

Case 2:

If (r)

For (int n=1; n<=29; Cout< n++);
The else

For (int n=1; n<=28; Cout< n++);
break;

Case 4:

Case 6:

Case 9:

Case 11:

For (int n=1; n
  • Related