#include <iostream>
using namespace std;
// Write your ADCChannel class here
class ADCChannel{
private:
int channel;
int resolution;
static int sanitizeChannel(int ch){
if(ch>15){ch = 15;}
else if(ch<0){ch = 0;}
return ch;
}
static int sanitizeResolution(int r){
if((r!=8)&&(r!=10)&&(r!=12)){r=12;}
return r;
}
public:
ADCChannel(int ch, int res)
: channel(sanitizeChannel(ch)),
resolution(sanitizeResolution(res)){
}
void print(){
cout << "CH=" << channel <<" RES="<<resolution;
}
};
int main() {
int ch, res;
cin >> ch >> res;
ADCChannel adc(ch, res);
adc.print();
return 0;
}
Input
3 10
Expected Output
CH=3 RES=10