11 条题解
- 1
信息
- ID
- 89
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 1
- 标签
- 递交数
- 266
- 已通过
- 195
- 上传者
#include <iostream>
using namespace std;
int main()
{
int q;
cin>>q;
cout<<(q!=0);
return 0;
}
//换个思路,用判断结构。
#include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
/*把int类型转换成bool类型时,
如果int类型是0,则bool类型是False,
否则,bool类型是True。
反之亦然。
(True转换成int类型是1。)*/
//判断
if(a == 0)//是0
{
cout << 0;//输出0
}
else//不是0
{
cout << 1;//输出1
}
return 0;
}
//编写不易,请勿抄袭!
#include <iostream>
using namespace std;
int main()
{
int q;
cin>>q;
cout<<(q!=0);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
bool c=a;
int d=c;
cout<<d;
return 0;
}
🤭这是一道转换题,细心点就行啦!
#include <iostream>
using namespace std;
int main()
{
int a,b;
bool c;
cin >> a;
c = a;
b = c;
cout <<b;
return 0;
}
//根据题目要求说的即可,bool是布尔类型
#include <iostream>
using namespace std;
int main()
{
cout<<1;
return 0;
}
其实这样就可以过关了
擦“题”而过
没啥好说的强制转换即可
#include<stdio.h>
int main() {
int a;
bool b;
scanf ("%d",&a);
b=a;
printf ("%d",b);
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin >> a;
if (a != 0) cout << 1;
else cout << 0;
return 0;
}
#include<stdio.h> #include<stdbool.h> int main() { int a; bool b; scanf("%d",&a); b=a; printf("%d\n",b); return 0; }
第一次发 不大会