// test.cpp : 定义控制台应用程序的入口点。
//
#define _CRT_SECURE_NO_WARNINGS
#include "stdafx.h"
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdlib.h>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char * apple1(char * str){
char * Body = (char *)malloc(strlen(str) + 1);
char * tmp = (char *)malloc(strlen(str) + 1);
char * tmpnum = (char *)malloc(strlen(str) + 1);
char * start = tmp;
char * numstart = tmpnum;
while (*str != '\0') {
if ((*str >= 'A'&&*str <= 'Z') || (*str >= 'a'&&*str <= 'z')) {
*tmp = *str;
tmp++;
}
else if (*str >= '0'&&*str <= '9'){
*tmpnum = *str;
tmpnum++;
}
str++;
}
*tmp = '\0';
*tmpnum = '\0';
cout << start << endl;
cout << numstart << endl;
strcpy_s(Body, strlen(Body), start);
strcat(Body, numstart);
cout << Body << endl;
free(start);
free(numstart);
return Body;
}
int _tmain(int argc, _TCHAR* argv[])
{
char * str = "1919china";
char * dst1 = (char *)apple1(str);
return 0;
}