更新时间2020-11-24 09:51:17
#include<bits/stdc++.h> using namespace std; main() {int a,b,c;cin>>a>>b;if(a%400==0)c="ture";else if(a%4==0&&a%100!=0)c="ture";elsec="false";}
按你的程序作了修改,程序如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
string c;
cin>>a;
if(a%400==0||a%4==0&&a%100!=0)
c="true";
else
c="false";
cout<<c<<endl;
return 0;
}
你的程序主要是错在把字符串常量赋给了整型变量了:
c="ture";
c="false";
程序的三种运行结果如下:
下一篇:你的电脑,内存条容量有多大