使用冒泡排序既可以很容易的解决问题的呢,呵呵 {
源程序如下:
#include
#include
#define N 3
using namespace std;
int main()
{
int a,b,p[3],t;
cout<<"输入"<
for(a=1;a
t=p[b];
p[b]=p[b+1];
p[b+1]=t;
}
cout<<"排序结果为:";
for(a=0;a
}
#include
#include
#include
using namespace std;
int main()
{
cout<<"Plese input three int numbers:"<
int n;
while(cin>>n)
{
int_vec.push_back(n);
}
sort(int_vec.begin(),int_vec.end());
vector
while(i!=int_vec.size())
{
cout<
}
cout<
}
调试过·可以得到正确结果。
#include
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if (a {
int temp=a;
a=b;
b=temp;
}
if (c>a)
{
cout<
else if (c {
cout< }
else
{
cout< }
return 0;
}
#include
int get_max(int a,int b,int c)
{
int max;
max=a;
if(b>a)
max=b;
if(c>max)
max=c;
return max;
}
int main()
{
int a,b,c;
int max;
printf("请输入三个整数\n");
scanf("%d%d%d",&a,&b,&c);
max=get_max(a,b,c);
printf("最大的数为%d\n",max);
return 0;
}
#include
#include
#include
using
namespace
std;
int
main()
{
cout<<"Plese
input
three
int
numbers:"<
int_vec;
int
n;
while(cin>>n)
{
int_vec.push_back(n);
}
sort(int_vec.begin(),int_vec.end());
vector
i=0;
while(i!=int_vec.size())
{
cout<
}
cout<
0;
}
调试过·可以得到正确结果。