OK thanks . i manage to solve the problem already :)
Type: Posts; User: Alexie
OK thanks . i manage to solve the problem already :)
i have do a research on inword = 1; else inword = 0; that all the number and char = 1 and space = 0; how can i do it on my code?
After looking at the code again. I think i got a problem with it again.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <ctype.h>
int main()
{
Thanks for that too. good idea:wink:
Hey Adak! Thanks for your explanation. I got my code working.
if((str[i]== ' ' && str[i+1] != ' ' && inWord++ ))
and also
printf("\n\nThe total number of words are %d ",...
i did use <ctype.h> for counting space
while(str[len]!='\0') len++;
for(i=0;i<=len;i++)
{
while( isspace( str[i] )) { space++; i++; }
{continue;}
...
Oh. so how should i code to let the program know it begin with a space?
I manage to solve the first error by change the line to:
if((str[i]== ' ' && str[i+1] != ' '))
Input: a[space][space][space]d
Output: 2 words
But the next problem I can't solve is:
Input:...
Ok thanks alot. I will try to get a copy soon :)
I don't have any book to learn. I was learn it through youtube.
Thanks for the reply.
Can you guy help out with my code? I'm still learning in my progress.
This is a simple program but i got a small problem with it.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char str[50];