#include <iostream>
#include <string>
using namespace std;
int main()
{
string str[12];
string tmp;
int y=0,x=0,b=0;
while(1)
{
cout<<"now,input a word:";
getline(cin,tmp);
for(int i=b;i<12;i++)
{
if(str[i]==tmp)
{
cout<<"find the some word occurs two times:"<<tmp<<endl;
cout<<"break out from while"<<endl;
y=1;
break;
}
else y=0;
}
if(y==1)break;
cout<<"no find the some,continue"<<endl;
str[x++]=tmp;
b=x-1;
}
system("pause");
return 0;
}
#include <string>
using namespace std;
int main()
{
string str[12];
string tmp;
int y=0,x=0,b=0;
while(1)
{
cout<<"now,input a word:";
getline(cin,tmp);
for(int i=b;i<12;i++)
{
if(str[i]==tmp)
{
cout<<"find the some word occurs two times:"<<tmp<<endl;
cout<<"break out from while"<<endl;
y=1;
break;
}
else y=0;
}
if(y==1)break;
cout<<"no find the some,continue"<<endl;
str[x++]=tmp;
b=x-1;
}
system("pause");
return 0;
}
版权声明:本文为u011278039原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。