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> #include<string.h> int main() { char a[255]; int i,n,j,m,judge; cin>>a; while ( a[0]!='*' ) { judge=0;i=0;j=0; n=strlen(a); if ( (a[0]!='+'&&a[0]!='-')&&(a[0]<'0'||a[0]>'9') ) goto found; for ( m=0 ; m<n ; m++ ) { if ( a[m] == '.' ) i=m; if ( a[m] == 'e' || a[m] == 'E') j=m; } if ( i==0 ) goto found; for ( m=1 ; m<i ;m++ ) if ( a[m]<'0' || a[m]>'9' ) goto found; if ( a[m+1]<'0'||a[m+1]>'9' ) goto found; if ( j!=0 ) { for ( i++ ; i<j ;i++) if ( a[i]<'0' || a[i]>'9' ) goto found; if ( (a[j+1]!='+'&&a[j+1]!='-')&&(a[j+1]<'0'||a[j+1]>'9') ) goto found; j+=2; for ( ; j<n ;j++) if ( a[j]<'0' || a[j]>'9' ) goto found; } judge = 1; found: if ( judge ==1 ) cout<<a<<" is legal."<<endl; else cout<<a<<" is illegal."<<endl; cin>>a; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator