ماهو الخطأ في هذا الكود
البرنامج عبارة عن فنكشن تجزء الكلمات بعدين ابي اطبعها بالعكس
بس ماضبط مادري ليه؟؟
#include <iostream.h>
#include <cstring> //prototype for strtok
int main()
{
char text[100], output[60][20];
//the string contain maximum 60 tokeniz and 20 letters.
char *tokens = text , *ptr;
int i = -1, j;
cout << "\nEnter a line of text not more than 100 character: \n";
//to input a line of text contains speases or coma
cin.getline(text , 100, '\n');
tokens = strtok( text , " ");
ptr = tokens;
while( tokens != NULL )
{
i++;
cout << tokens << '\n';
j = 0;
ptr = tokens;
while (*ptr)
{
output[j] = *(ptr++);
j++;
}
output[j] = '\0';
}
//print sentence after tokeniz
cout <<"The sentense after tokeniz is : \n";
for (; i>=0; i--)
{
for (j=0; output[j]!='\0'; j++)
{
cout << output[j];
}
cout << " ";
}
return 0;
}