Acm练习(五)
1.//ASCLL码值排序
/*#include<iostream>
using namespace std;
void chushi(char a[3])
{
for(int i=0;i<3;i++)
{
cin>>a[i];
}
}
void paixu(char a[3])
{
for(int i1=0;i1<3;i1++)
for(int i2=i1;i2<3;i2++)
{
if(a[i1]>a[i2])
{
char temp=a[i1];
a[i1]=a[i2];
a[i2]=temp;
}
}
cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
}
int main()
{
int N;
cin>>N;
char a[3];
for(int m=0;m<N;m++)
{
chushi(a);
paixu(a);
}
return 0;
}*/
2.//奇偶分离
/*#include<iostream>
using namespace std;
void jishu(int n)
{
int i=0;
for(i;i<n+1;i++)
{
if(i%2==1)
{
cout<<i<<" ";
}
}
cout<<endl;
}
void orshu(int n)
{
for(int i1=1;i1<n+1;i1++)
{
if(i1%2==0)
{
cout<<i1<<" ";
}
}
cout<<endl;
}
int main()
{
int N;
cin>>N;
int m;
for(int l=0;l<N;l++)
{
cin>>m;
jishu(m);
orshu(m);
}
return 0;
}*/
3.//斐波锲那函数
/*#include<iostream>
using namespace std;
int fei(int n)
{
if(n==1||n==2)
return 1;
else
return (fei(n-2)+fei(n-1));
}
int main()
{
int m;
cin>>m;
int s;
for(int p=0;p<m;p++)
{
cin>>s;
cout<<fei(s)<<endl;
}
}*/