1 In chuỗi theo các từ mỗi từ một dòng Thu Aug 18, 2011 9:27 pm
El Kun
Super Moderator
In chuỗi theo các từ mỗi từ một dòng
- Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char s[50];
int i, len;
printf("\nNhap vao mot chuoi : ");
gets(s);
len = strlen(s);
i = 0;
while (i<len)
{
while (s[i] == ' ' && i<len)
i++;
while (s[i] != ' ' && i<len)
putc(s[i++], stdout);
putc('\n', stdout);
}
getch();
}