Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:Runtime Error各位大牛帮忙看看为什么吧

Posted by a65982021 at 2012-07-31 20:44:52 on Problem 2503
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator