用c++写的 共三个.cpp文件
大家有没有什么好建议,提一下,我刚开始学习编程
这是我们书上的练习
#include <iostream>
#include <string>
using namespace std;
extern void display(int,int,int);
//全局变量
string month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};
int year,day,flag;
int main()
{
cout<<"What year do you want a calendar for?"<<endl;
cin>>year;
cout<<"What day of the week does January 1 fall on?"<<endl;
cout<<"(Enter 0 for Sunday,1 for Monday. etc.)"<<endl;
cin>>day;
if (day>7||day<0)
{
cerr<<"the day must from 0 to 6!!"<<endl;
return -1;
}
if (year%400==0||(year%4==0&&year%100!=0))
{
cout<<year<<" is a leap year."<<endl;
flag=1;
}
else
{
cout<<year<<"is not a leap year."<<endl;
flag=0;
}//not leap year
system("pause");
display(flag,year,day);
return 0;
}