⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3_13.cpp

📁 c++书籍的源代码
💻 CPP
字号:
#include<iostream.h>
#include<iomanip.h>
 void swap(int &a,int &b);//函数声明
 int main()
{
 void sort(int &a,int &b,int &c);//函数声明
 int a,b,c;
 cout<<"请输入三个整数:"<<endl;
 cin>>a>>b>>c;
 sort(a,b,c);//函数调用
 cout<<setw(3)<<a<<setw(3)<<b<<setw(3)<<c<<endl;
 return(0);
} 
 void sort(int &a,int &b,int &c)//函数定义
{
 if(a>b)
  swap(a,b);
 if(a>c)
  swap(a,c);
 if(b>c)
  swap(b,c);
}
 void swap(int &a,int &b)//函数定义
{
 int t;//定义中间变量
 t=a;
 a=b;
 b=t;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -