问答题
请编写一个函数display(),该函数要求用户先输入一字符串,然后在屏幕上再输出该字符串(假设该字符串长度小于 100)。注意:部分源程序已存在文件test35_2.cpp中,
请勿修改主函数main和其他函数中的任何内容,仅在函数display()的花括号中填写若干语句。
如输入abc,输出结果如下:
please input string:
abe
abc
Press any key to continue
文件 test35_2.cpp 的内容如下:
#include <iostream.h>
#include <conio.h>
void display()
{
}
void main( )
{
cout<<"please input string:" << end1;
display ( );
}
【参考答案】
void display() { char str[100] ch; int i=0; while ((ch=getch......
(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)