#include <iostream>
using namespace std;
int main()
{
char str[40] = { 0 };
int i = 0;
while (cin.peek() != 'c')
{
ustr[i] = cin.get();
i++;
}
cout << str << endl;
return 0;
}

这段C++代码演示了一个简单的程序,它从标准输入读取字符,直到遇到字符'c'为止。程序将所有读取到的字符存储在一个字符数组中,并在找到'c'或读取到数组满时停止。最后,它打印出接收到的字符串。
#include <iostream>
using namespace std;
int main()
{
char str[40] = { 0 };
int i = 0;
while (cin.peek() != 'c')
{
ustr[i] = cin.get();
i++;
}
cout << str << endl;
return 0;
}

2333

被折叠的 条评论
为什么被折叠?