|
|
вернуться в форумPlease help me ! Why I got Compilation Error in C++ ? Here my code : #include <stdio.h> #include <conio.h> long pt,i,n ; int x ; int tt , stack ,L[1000] , B[100000] ; long A[100000] ; char s[4] ; void main() { scanf("%ld",&n) ; pt = 0 ; for ( i=1 ; i <= n ; i++ ) { scanf("%s",&s); if ( s[0] == 'P' && s[1] == 'O' ) { scanf("%ld",&A[i]) ; A[i] = - A[i] ; } else { scanf("%d%ld",&x,&A[i]) ; pt += 1 ; B[pt] = x ; } } for ( i=1 ; i <= 1000 ; i++ ) L[i] = 0 ; for ( i=n ; i > 0 ; i-- ) { if ( A[i] > 0 ) { stack = B[pt] ; pt -= 1 ; if ( L[stack] > 0 ) { tt = L[stack] ; L[stack] = A[tt] ; A[tt] = A[i] ; } A[i] = -1 ; } else { stack = - A[i] ; A[i] = L[stack] ; L[stack] = i ; } } for ( i=1 ; i <= n ; i++ ) if ( A[i] >= 0 ) printf("%ld \n",A[i]) ; } Re: Don't use <conio.h> (-) Thank you very much ! |
|
|