64,646
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
using namespace std;
void main()
{
const int iLen = 100;
string pswords[iLen];//定义一个string数组,将输入的词组储存在其中
int index=0;
while(getline(cin,pswords[index]))//这里应该是cin
{
if(index++ == iLen - 1)
break;
}
for (int i = 0; i< iLen ;i++)
cout << pswords[i] << endl;
}
#include <iostream>
#include <string>
using namespace std;
void main()
{
const int iLen = 100;
string pswords[iLen];//定义一个string数组,将输入的词组储存在其中
int index=0;
while(getline(cin,pswords[index]))//这里应该是cin
{
if(index++ == iLen - 1)
break;
}
for (int i = 0; i< iLen ;i++)
cout << pswords[i] << endl;
}
#include <iostream>
#include <string>
using namespace std;
void main()
{
string pswords[100];//定义一个string数组,将输入的词组储存在其中
int index=0;
while(getline(cin,pswords[index]))//这里应该是cin
{
if (pswords[index]=="0")//判断字符串结束
{
break;
}
index++;
}
}