题库 信息学奥赛题库 题目列表 2007年NOIP初赛普及组完善程序:(求字符串的逆序)下面...
填空题

2007年NOIP初赛普及组完善程序:(求字符串的逆序)下面的程序的功能是输入若干行字符串,每输入一行,就按逆序输出该行,最后 键入-1 终止程序。

请将程序补充完整。

#include <iostream.h>
#include <string.h>

int maxline = 200, kz;

int reverse(char s[]) {
    int i, j, t;
    for (i = 0, j = strlen(s) - 1; i < j; 【①】 , 【②】 )
    {
        t = s[i];
        s[i] = s[j];
        s[j] = t;
    }
    return (0);
}


void main() {
    char line[100];
    cout << "continue? -1 for end." << endl;
    cin >> kz;
    while (【③】)
    {
        cin >> line;
        【④】;
        cout << line << endl;
        cout << "continue ? -1 for end." << endl;
        cin >> kz;
    }
}
题目信息
完善程序 2007年 初赛
-
正确率
0
评论
208
点击