?? chapter3-4.cpp
字號:
//文件名:CHAPTER3-4.cpp
#include <iostream.h>
// 定義多態函數,找出三個整數中最小的數
int min0(int ii, int jj, int kk)
{
int temp;
if((ii<jj)&&(ii<kk)){temp=ii;}
else if((jj<ii)&&(jj<kk)){temp=jj; }
else{ temp=kk; }
return temp;
}
// 定義多態函數,找出三個小數中最小的數
float min1(float ii, float jj, float kk)
{
float temp;
if((ii<jj)&&(ii<kk)){temp=ii;}
else if((jj<ii)&&(jj<kk)){temp=jj; }
else{ temp=kk; }
return temp;
}
// 定義多態函數,找出三個子符中最小的字符
char min2(char ii, char jj, char kk)
{
char temp;
if((ii<jj)&&(ii<kk)) {temp=ii; }
else if((jj<ii)&&(jj<kk)){temp=jj;}
else{temp=kk;}
return temp;
}
// 下面是主函數
void main()
{
int temp1=min0(100,20,30);
cout<<temp1<<endl;
float temp2=min1(10.60,10.64,53.21);
cout<<temp2<<endl;
char temp3=min2('c','a','C');
cout<<temp3<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -