| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:Runtime Error各位大牛帮忙看看为什么吧In Reply To:Runtime Error各位大牛帮忙看看为什么吧 Posted by:y08liuya at 2012-04-26 10:48:27 > #include<iostream>
> #include<string>
> using namespace std;
> struct dictionary{
> char orgi[25];
> char dic[25];
> };
> dictionary dd[10001];
> int main(){
> int count=0;
> int sum=0;
> int i;
> bool tag;
> char ss[25],*ch;
> while(gets(ss) && ss[0]!='\0' &&count<100000){
> ch=strstr(ss," ");
> int address=ch-ss;
> strcpy(dd[count].dic,&ss[address+1]);
> ss[address]='\0';
> strcpy(dd[count].orgi,ss);
> count++;
>
> }
> while(gets(ss) && ss[0]!='\0' && sum<100000){
> sum++;
> tag=false;
> for(i=0;i<=count;i++)
> if(strcmp(dd[i].dic,ss)==0){
> tag=true;
> break;
> }
> if(tag)
> cout<<dd[i].orgi<<endl;
> else
> cout<<"eh"<<endl;
> }
> return 0;
> }
数组开小了,100001
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator