ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1220. Stacks

Please, help me. Why Compilation Error in C++ ?
Posted by Nguyen Dinh Tu (DHSP) 19 Jul 2005 17:00
#include <iostream.h>
const int max=100000;
using namespace std;

int main()
{
int Stack[max];
long Value[max];
long n;
long m;
char c;
int t;
char k;
cin>>n;
while (n > 0)
  {
    cin>>c>>c;
    if (c == 'U')
      {
         cin>>k>>k;
        m++;
        cin>>Stack[m]>>Value[m];
      }
    else
      {
        cin>>k;
        cin>>t;
        for (long i = m; i>=1; i--)
          if (Stack[i] == t)
            {
              Stack[i] = 0;
              cout<<Value[i]<<endl;
              break;
            }
      }
    n--;
  }
return 0;
}

Edited by author 19.07.2005 17:01
I corrected your code: (+)
Posted by qwerty 19 Jul 2005 18:32
#include <iostream>
#define max 100000
using namespace std;

int main()
{
int Stack[max];
long Value[max];
long n;
long m;
char c;
int t;
char k;
cin>>n;
while (n > 0)
{
cin>>c>>c;
if (c == 'U')
{
cin>>k>>k;
m++;
cin>>Stack[m]>>Value[m];
}
else
{
cin>>k;
cin>>t;
for (long i = m; i>=1; i--)
if (Stack[i] == t)
{
Stack[i] = 0;
cout<<Value[i]<<endl;
break;
}
}
n--;
}
return 0;
}
Thank you very much !
Posted by Nguyen Dinh Tu (DHSP) 20 Jul 2005 16:33
I don't know C, C++ much.
I used Dev-C++ to write my error code
-> Compilation Success but Submit with CE.
What  programming do you use to submit with C++?
Thanks.

Edited by author 20.07.2005 16:35
Thank you very much !
Posted by Nguyen Dinh Tu (DHSP) 20 Jul 2005 16:34
I don't know C, C++ much.
I used Dev-C++ to write my error code
-> Compilation Success but Submit with CE.
What programming do you use to submit with C++?
Thanks.
I use Dev-Cpp and Borland C++ (-)
Posted by qwerty 20 Jul 2005 22:36