# Thread: Pls help!

1. ## Pls help!

I have a problems with converting strings to number,
for example,
one thousand nine hundred eighty three -->> 1983

I have thought for a long long time, but couldn't think of how to do the coversion.

At the begining, I want to assign each number, i.e. one, two, three...ten, an array like a1[] = "one", a2[] = "two"......
that more than 10 arrays will be needed. The main problem is that I can't extract "one" in the string of words to compare. I really get stuck now, please help me. thx!!

2. Someone had a pretty nice post on this same exact subject awhile ago. Perhaps someone will dig it up.

3. Originally posted by SilentStrike
Someone had a pretty nice post on this same exact subject awhile ago. Perhaps someone will dig it up.
What are the keywords should I search for??
thx!!

4. help me pls..... thx....

5. no one is able to help me??

#include "stdio.h"
#include "string.h"

#define MAXLINESIZE 1001
#define MAXWORDSIZE 50
#define MAXWORDNUMBER 20

void main()
{
char words[MAXWORDNUMBER][MAXWORDSIZE];
int i = 0, j = 0, k = 0, chr;

printf( "Enter Value : " );

/* This part is to split all words and assign each word to an array orderly */

for( k = 0; (k < MAXLINESIZE) && ((chr = getchar()) != EOF)
&& (chr != ' '); k++ ) {

if (chr != ' ') {
words[i][j] = (char) chr;
j++;
words[i][j] = null terminate; /* I cannot type null terminate */
}
else {
words[i][j] = null terminate; /* I cannot type null terminate */

i++;
j = 0;
}
}

/* At this moment 'i' is the upper value of array 'words'.
In other words, 'i+1' is the total no. of words you input. */

for (k = 0; k < i + 1; k++){
printf("%s ", words[k]);

/* wirte the conversion program */

}

return;
}

I can't complie it.... can anyone point out the errors?
thx!!

Popular pages Recent additions