Oct 14, 2010 at 4:22pm UTC
I am trying to create a word counting program and cannot. This is what I have so far:
#include<stdio.h>
#include<string.h>
#include<iostream>
#define IN
#define OUT
#define BUFF_SIZE 1000
int main(void)
{
char inarray[BUFF_SIZE];
char inptr;
int x, num_words, num_lines, count;
num_words = 0;
num_lines = 0;
count = 1;
count = 0;
printf("Enter text to be counted: \n");
scanf("%d",&num_words);
if(x==' '||x=='\n'||x=='\t')
count =0,
num_words = 0;
else if(count==0)
count=1;
++num_words;
printf("%d\n", num_words);
system("pause");
return 0;
}
Oct 14, 2010 at 6:02pm UTC
Could you be more specific as to your problem?
Oct 14, 2010 at 6:43pm UTC
It does not count the total number of words in any sentence that I imput. It compiles but only shows number 1 no matter how many words I enter. I am not sure if I am even doing this right.