View Single Post
Old 04-24-2005, 08:12 AM   #1 (permalink)
rogue
Registered User
 
Join Date: Apr 2005
Posts: 9
rogue is on a distinguished road
need help with copying backwards c++

ok i am a newbie here. I am just learning this material . please be nice. i
i am trying to make a program spell backwards. almost a wordgame anyways the user will enter a word up to 20 characters and then the program will type it backwords. i thought i had this perfect but it comes up with a header function error. this is my code. Can anyone give me any pointers on how to fix this?( i have more code then this and the rest of it works fine ) but this option i cant seem to get it to work.
Thank you
~VAl

void WordGame1(void)
{
char str_frontwards[20];
char str_backwards[20];


while (str_frontwards[20] != '\0')




}



/*coping a string to spell backwards*/




{
char str_frontwards[20];
char str_backwards[20];

strcpy (str_backwards[0],str_frontwards[20]);
strcpy (str_backwards[1],str_frontwards[19]);
strcpy (str_backwards[2],str_frontwards[18);
strcpy (str_backwards[3],str_frontwards[17]);
strcpy (str_backwards[4],str_frontwards[16]);
strcpy (str_backwards[5],str_frontwards[15]);
strcpy (str_backwards[6],str_frontwards[14]);
strcpy (str_backwards[7],str_frontwards[13]);
strcpy (str_backwards[8],str_frontwards[12]);
strcpy (str_backwards[9],str_frontwards[11]);
strcpy (str_backwards[10],str_frontwards[10]);
strcpy (str_backwards[11],str_frontwards[9]);
strcpy (str_backwards[12],str_frontwards[8]);
strcpy (str_backwards[13],str_frontwards[7]);
strcpy (str_backwards[14],str_frontwards[6]);
strcpy (str_backwards[15],str_frontwards[5]);
strcpy (str_backwards[16],str_frontwards[4]);
strcpy (str_backwards[17],str_frontwards[3]);
strcpy (str_backwards[18],str_frontwards[2]);
strcpy (str_backwards[19],str_frontwards[1]);
strcpy (str_backwards[20],str_frontwards[0]);



printf ("str_backwards[20]");
printf ("str_backwards[19]");
printf ("str_backwards[18]");
printf ("str_backwards[17]");
printf ("str_backwards[16]");
printf ("str_backwards[15]");
printf ("str_backwards[14]");
printf ("str_backwards[13]");
printf ("str_backwards[12]");
printf ("str_backwards[10]");
printf ("str_backwards[9]");
printf ("str_backwards[8]");
printf ("str_backwards[7]");
printf ("str_backwards[6]");
printf ("str_backwards[5]");
printf ("str_backwards[4]");
printf ("str_backwards[3]");
printf ("str_backwards[2]");
printf ("str_backwards[1]");
printf ("str_backwards[0]");
}

Last edited by rogue; 04-24-2005 at 02:51 PM. Reason: c== in title
rogue is offline   Reply With Quote