Viết hàm in mỗi chuỗi trên từng dòng
Code:
#include <bits/stdc++.h>
using namespace std;
void Enter_string(char *s = new char[5000])
{
int a[100000];
for(int i = 0 ; i < strlen(s); i++)
a[i] = *(s+i);
for(int i = 0 ; i < strlen(s) ; i++)
{
if(*(s+i) == ' ')
cout<<endl;
if(*(s+i) != ' ')
cout<<(char)*(s+i);
}
}
int main()
{
char *s = new char[5000];
gets(s);
Enter_string(s);
return 0;
}