#include <iostream>
using namespace std;
// Write your ADCChannel class here
class ADCChannel{
private:
int channel;
int resolution;
static int valid_channel(int x)
{
if(x < 0) x =0;
else if(x>15) x =15;
return x;
}
static int valid_resolution( int r)
{
switch(r)
{
case 8:
r =8;
break;
case 10:
r =10;
break;
case 12:
r = 12;
default:
r=12;
}
return r;
}
public:
ADCChannel(int ch , int res):channel(valid_channel(ch)),resolution(valid_resolution(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