-
I specified the end date in the program, and if necessary, you can read it in with the command line, very easy
-
#include
using namespace std;
int main()
int a=;The cumulative number of days in the month.
int year, month, day;
cin>>year>>month>>day;
*Calculation of the number of days in the current year***
int days = a[month-1] +day;The number of days in the current year.
if((month> whether the current year is a Swiss year.
days++;
*The year of the middle difference is actually calculated ***
int temp = year - 2000;The year in the middle of the difference.
days += 365 * temp;
for(int i=2000; icoutreturn 0;
-
case 1: case 2:……It should be in this form, month is an integer not a character, and there is no need to add ''
-
It's not simple, make a two-dimensional array a[2][12] to store months, a[0] to store common years, and a[0] to store leap years! Just add it up with the for loop!
-
#include
using namespace std;
const int a[13]=;
int n,y,t,sum;
int main()
sum+=t;
if ((n%4==0) &n%100!=0)) n%400==0))
sum+=1;
printf("This day is the %d day of the year. ",sum);
system("pause");
return 0;
Notepad written, no input time error maintenance, hope it helps - Mianzhong oi13 level.
-
You can use datetime to get the complex.
That is, the current date system is the first day of the year, for example, 2012-02-20 now shows the 51st day of 2012.
If there's a character, that's it.
string str = "2012/02/20 12:00:00";
It's the same way.
-
Leave a space after the keyword case Ha:
#include
using namespace std;
void main()
cout <<"For the first of the year" <
-
You're not wrong with me, there's nothing wrong with this, I've run it.
Operating environment GCC
#include
using namespace std;
main()
In the case of leap years, then March and later months are calculated with +1 (28 days in February and 29 days in leap years).
cout<
-
#include
#include
int main()
if (look)
day1 += day + 1;
elseday1 += day;
printf("%d year, %d month, %d day is the %d day of the year", year, month, day, day1);
system("pause");
return 0;}
-
if(The problem is here.)
In C++, the comparison operator should be "==" instead of "=".
It is recommended to write if(1== next time, so that if something goes wrong, the compiler will report an error.
Hope it helps!!
-
#include
using namespace std;
int main()
int a[12]=;
int year,month,day;
int sum=0;
cout<<"Please enter the year, month and day">year>>month>>day;
if(month==1)
sum=day;
else if(month<=2)
sum=31+day;
elseif(year%100==0)
if(year%4==0)
for(int i=0;isum=sum+a[i];
sum=sum+1+day;
elsefor(int k=0;ksum=sum+a[k];
sum=sum+day;
elseif(year%4==0)
for(int i=0;isum=sum+a[i];
sum=sum+1+day;
elsefor(int k=0;ksum=sum+a[k];
sum=sum+day;
cout<<>
The watchtower owner.
-
#include
void main()
cout<<"Please enter your year, month, and day:"cin>>year>>month>>day;
for(int i=0;i2)
cout<<"This day is the first day of the year"
-
for (i=0;i The day above has been added many times.
Do you know? When astronauts in space look back at our Earth, they find that Earth is a beautiful blue "water ball" in the vast universe. >>>More
The analysis of China's great achievements in the 21st century is as follows: >>>More
Diversified development, the combination and decomposition of multiple dance genres.
Earlier, when it came to participating in weddings in Shanghai, the biggest impression was that the process of toasting and lighting cigarettes was the most difficult. >>>More
Although in 1995 in China's computer and Internet, but because Ma Yun went abroad, especially the United States and other Western countries computers and networks have been very popular, so it is not difficult to make such a **, the key is to seize this opportunity to appear to be a master. I remember there was a TV set that filmed their business start-up, and it was really hard at the time, but it worked out.