Description
If you assign the value of an integer variable to a boolean variable, and then assign the value of the boolean variable to an integer variable, what is the value you get?
Input
An integer in the integer range, that is, the initial value of the integer variable.
Output
An integer, the result obtained after going through the above process.
Input sample
3
Output sample
1
Answer
1 | #include <iostream> using namespace std; int main() { int i; bool b; cin>>i; b=(bool)i; i=b; cout<<i<<endl; return 0; } |
Result
Used memory: 200kB
Run time: 9ms
Language:G++
Submit time:2019-04-14 09:35:00
Problem link
http://noi.openjudge.cn/ch0102/01/
OpenJudge 09:Conversion between integer and Boolean
Comments