#include <iostream>
// if the parameter is outside [0,3] return -1,
// else return the inversion of the list formed
// by possible inputs
int func(int x)
{
return (x<0)?-1:
((x>3)?-1:
((x==3)?0:
((x==2)?1:
((x==1)?2:3))));
}
int main() {
std::cout << func(-1) << std::endl;
std::cout << func(0) << std::endl;
std::cout << func(1) << std::endl;
std::cout << func(2) << std::endl;
std::cout << func(3) << std::endl;
std::cout << func(4) << std::endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: