-
I am stumped...
Ok guys. This is my first post so i hope you are willing to help this cutie out a bit. here is my problem. I have been trying forever to be able to take an array fill it with user input and then take that array and break it up into all its different words.
ex.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
typedef struct {
char word;
int times;
}WORK;
main()
{
WORK part[50];
int num1=0,num2=0, num3,num5,num6=0, num7=0;
char ch,ch1,string[200], charstore[50];
printf("\n Please enter a some words\n");
gets(string);
num3=strlen(string);
scanf("%c%c", &ch,&ch);
num3--;
while (num1<=num3) //string to upper
{ //
ch1=string[num1]; //
string[num1]= toupper (ch1); //
// printf("%s\n", &string[num1]); //
num1++; //end string to upper
}
num1=0;
num3++;
while (num1<=num3)
{printf("%d\n",num1);
num5=0;
if (string[num1] <= '@'|| string[num1] >= '[')
{
num1++;
num5=1;
}
if (num5 == 0)
{
charstore[num6]=string[num1];
num1++;
num6++;
}
if (num5==1)
{
if (num6 !=0)
{
charstore[num6] = '\0';
printf("\n%s",&charstore);
// here is were i need code to make change from array to struct
num6=0;
num7++;
num1++;
}
else
num1++;
}
}
scanf("%c%c", &ch,&ch);
}
after this ... i want to be able to have the amount of times each word was in the array.
and if you are really in the mood... to help that is i am wondering how i can take all the words from the struct and alphabetize them.
Thanks
Heather [email protected]
-