#include<iostream>
#include<string.h>
#include <string>
using namespace std;
void SortVowel(const char *strInPut,char *strOutPut)
{
int iLen = strlen(strInPut);
char cTemp;
int iTemp = 0;
for(int i = 0; i < iLen; i++)
{
cTemp = strInPut[i];
if(cTemp == 'a'||cTemp == 'e'||
cTemp == 'i'||cTemp == 'o'||
cTemp == 'u'||cTemp == 'A'||
cTemp == 'E'||cTemp == 'I'||
cTemp == 'O'||cTemp == 'U')
{
strOutPut[iTemp++] = cTemp;
}
}
strOutPut[iTemp] = '\0' ;
for(int i = 0 ; i < (iTemp - 1) ; i++)
{
for(int j = i+1 ; j < (iTemp) ; j++ )
{
if(strOutPut[i] > strOutPut[j] )
{
cTemp = strOutPut[i];
strOutPut[i] = strOutPut[j];
strOutPut[j] = cTemp;
}
}
}
std::cout<<"First Sort :"<<strOutPut<<std::endl;;
char *strTemp = new char[strlen(strOutPut)];
int iRecode = 0;
for(int i = 0; i < strlen(strOutPut) ; i++)
{
if(strOutPut[i] >= 'a' && strOutPut[i] <= 'z')
{
strTemp[iRecode++] = strOutPut[i];
}
}
int iRecodeTemp = iRecode;
for(int i = 0; i < ( strlen(strOutPut) - iRecodeTemp ); i++)
{
strTemp[iRecode++] = strOutPut[i];
}
for(int i = 0; i < strlen(strOutPut) ; i++)
{
strOutPut[i] = strTemp[i];
}
delete[]strTemp;
}
int main()
{
char RetBuffer[100];
SortVowel("Abort!MayBe Some Errors In Out System",RetBuffer);
std::cout << RetBuffer<<std::endl;
return 0;
}
回寝室之前 写了一个 小题目 aeiou 元音字母 排序
最新推荐文章于 2022-09-09 00:13:19 发布