C++代码
  1. /*  
  2. Title: Reverse Text  
  3. Problem URL: http://acm.zju.edu.cn/show_problem.php?pid=1295  
  4. Author: Moqi  
  5. Date: 2007-12-30  
  6. Description:   
  7. */  
  8. #include <stdio.h>   
  9. #include <string.h>   
  10.   
  11. int main()   
  12. {   
  13.     int i, n;   
  14.     char c[80];   
  15.     scanf("%d", &n);   
  16.     getchar();   
  17.     while (n > 0)   
  18.     {   
  19.         i = 0;   
  20.         while ((c[i++] = getchar()) != ‘\n’)   
  21.             ;   
  22.         i–;   
  23.         while (–i >= 0)   
  24.             putchar(c[i]);   
  25.         printf("\n");   
  26.   
  27.         n–;   
  28.     }   
  29.     return 0;   
  30. }