Need help with my code. The programm is done in 90% or more, but doesn't work right. I don't know what to do, because I'm learning c++ for 3 months, but I have to do this work. Also I'm sorry for my English, I'm from Russia.
"The function overwrites the string. If it finds a number on the line, then instead of it it overwrites the corresponding word from the input line into the output line. (for example, "aaa bb1bb cc2cc" - "aaa bbaaabb ccbb1bbcc"). Repeat this process until there are no numbers left in the line. Check the possible loops when two words refer to each other."
#include <iostream>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <conio.h>
void tekst(char c[], char d[])
{
int i, j, k=0, b[20], n;
for (i=0; c[i]!=0; i++) //Writes the indices of the beginnings of words. The cycle of recording the indices of the beginning of words.
{
if (!(c[i]==' '))
{
b[k++]=i;
while (!(c[i]==' '|| c[i+1]==0))
i++;
}
}
for (i=0, j=0; c[i]!=0; i++)
{
if (c[i]>='0' && c[i]<='9')
{
n=c[i]-'0';
i++;
while (c[i]>='0' && c[i]<='9');} // Translating from char to int numbers. A cycle of translating a number from char [] to int.
else d[j++]=c[i]; // If there are no numbers in the word, overwrite it. The cycle of the creating a new array.
}
d[j]=0;
}
void main(){
setlocale(LC_ALL, "Russian");
char c[80],d[80];
int r;
puts ("Введите строку слов: "); // Enter a string of words
gets (c);
tekst(c,d);
for (r=0; d[r]!=0; r++)
if (d[r]>='0' && d[r]<='9') // If there are numbers, then run again
tekst(d,c);
printf(c);
_getch();
}