void SB(char ch){ switch(ch){ case 'A':case 'a': cout<<\ case 'B':case 'b': cout<<\ case 'C':case 'c': cout<<\ default:
cout<<\ } }
void main(){
char a1='b',a2='C',a3='f'; SB(a1);SB(a2);SB('A'); cout< 答案:good!pass!well! 2. #include double SD(int a,int b,char op){ double x; switch(op){ case '+':x=double(a)+b;break; case '-':x=double(a)-b;break; case '*':x=double(a)*b;break; case '/': if (b) x=double(a)/b; else exit(1); break; default:exit(1); } return x; } void main(){ int x=20,y=12; cout< [答案] 8 240 3.2 3. #include void main(){ int s=0; for(int i=1;i<6;i++) s+=i*i; cout<<\} [答案] s=55 4. #include for( int i=1;;i++){ if(s>50)break; if(i%3==0)s+=i; } cout<<\} [答案] i,s=19,63 5. #include cout< [答案] 25 20 6. #include [答案] y*y=441 三、 写出下列每个函数的功能 1. #include int SA(int a,int b){ if(a>b)return 1; else if(a==b) return 0; else return -1; } [答案] 1 a>b 函数返回值= 0 a=b -1 a #include [答案] 求三个数中的最大值 3. int SE(int n){ int x;cin>>x;if(n==1) return x;