编写一个程序读入一行输入,然后反向打印该行,您可以把输入存储在一个char数组中: 假定该行不超过255个字符。回忆一下,您可以使用具有%c说明符的scanf()从输入中一次 读入一个字符,而且当您按

来源:互联网 发布:中国新声音 网络直播 编辑:程序博客网 时间:2024/04/29 01:35
#include "stdafx.h"#include "stdlib.h" void main(){    int a=0,i=0;    char word[255];     printf("Please input a word: ");    scanf("%c",&a);     while(a<255 && a!='\n')    {        word[i++]=a;        scanf("%c",&a);    }     i--;    while(i>=0)        printf("%c",word[i--]);    printf("\n");     system("pause");}