0
Can someone fix it ?
https://code.sololearn.com/c4lm59wRMmN6/?ref=app It's just a simple code that is writing each word on a separate line ... thanks!
2 Respostas
+ 2
Here : 
#include <iostream>
#include <cstring>
using namespace std;
int main() 
{
    char s[101], *p; int wordcount = 0;
    // Use getline. gets is unsafe.
    cin.getline(s,101);
    // strtok separates string to words.
    p = strtok(s," ");
    while(p!=NULL)
    {
        cout<<p<<endl; wordcount++;
        p = strtok(NULL," ");
    }
    cout<<"Number of Words : "
            <<wordcount;
}
+ 1
Thanks a lot !



