hi..................
i o this program but i cant find the error
can u help me
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
//Number search fucnction
void searchnum(char *);
//Converting function
void convertdig(char *);
void main()
{
char text[100];
//Inputting the text and it's preconverting status
printf("Please input a text with numbers(1-99) to be converted into words:\n");
gets(text);
printf("\n%s\n%s","The text before conversion is:",text);
//Calling the searching function
searchnum(text);
}
void searchnum(char *text)
{
char *token;
//First call to tokenizing function
token=strtok(text," ");
printf("\n\nThe text after conversion is:\n");
//Loop to find the position of the number to call the converting function
while (token != NULL)
{
//If a digit is found
if (isdigit(token[0]))
convertdig(token);
//If a digit is not found
else
printf("%s ",token);
//To call the function to the end of the character string
token = strtok(NULL, " ");
}
}
void convertdig(char *text)
{
int num,num2;
char *rem;
num = strtol(text,&rem,0);
char *chr1[]={"One","Two","Three","Four","Five","Six","Seven", "Eight","Nine"};
char *chr2[]={"Eleven","Twelve","Thirteen","Forteen","Fifteen" ,"Sixteen","Seventeen","Eighteen","Nineteen"};
char *chr3[]={"Ten","Twenty","Thirty","Fourty","Fifty","Sixty" ,"Seventy","Eighty","Ninety"};
//Format of output number and range
if (num < 10)
printf("%s ",chr1[num-1]);
else if (num >= 10 && num <20)
printf("%s ",chr2[num-11]);
else
{
num2=num%10;
num=num/10;
printf("%s %s ",chr3[num-1],chr1[num2-1]);
}
}