#include<iostream>
using namespace std;
#include<string.h>
#include<stdio.h>
#include<conio.h>
char* catchuoi(char *s, int bt,int kt)
{
char p[100];
int k=0;
for(int i=bt;i<=kt;i++)
{
p[k++]=s[i];
}
p[k]='\0';
return p;
}
void XuatCacTu(char *s)
{
int start,end;
int k=strlen(s);
for(int i=0;i<k;i++)
{
if(s[i]!=' ')
{
start=i;
for(int j=start+1;j<=k;j++)
{
if(s[j]==' '||s[j]=='\0')
{
end=j-1;
char p[30];
strcpy(p,catchuoi(s,start,end));
printf("%s\n",p);
i=j;
break;
}
}
}
}
}
int main()
{
char s[]="chuc bnm dep ";
XuatCacTu(s);
getch();
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.