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 |
指针有什么错误呀???#include<iostream.h> void main() { char *str,*p; int n; int x,y,xx,yy; int ok; float area; int area1; cin>>n; while(n>=1){ cin>>str; p=str; ok=0; area=0;area1=0; x=0;y=0;xx=0;yy=0; while(!ok){ switch(*(p++)){ case '1' : xx=x-1;yy=y-1;break; case '2' : yy=y-1; break; case '3': xx=x+1;yy=y-1;break; case '4': xx=x-1;break; case '5': ok=1; break; case '6': xx=x+1;break; case '7': xx=x-1;yy=y+1;break; case '8': yy=y+1; break; case '9': xx=x+1;yy=y+1; } area1 += (yy+y)*(xx-x); x=xx;y=yy; } area = float(area1) / 2.0; area = area > 0 ? area : -area; cout<< area << endl ; n--; } } 我用turbo c++3.0编译和运行都没有错误,但是用turbo c++3.0编译能通过但运行时却报错: 3 cause a General Protection Fault in module KRNL386 at 0002:2fd4 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator