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 1094. E-screen

It said : "Crash (ACCESS_VIOLATION)", so what's wrong with my code?
Posted by za-Nuker 10 Apr 2005 11:20
I sent this program but it said Crash (ACCESS_VIOLATION).
I compiled with my Dev-C and Turbo C, both were ok.

#include <stdio.h>

int main(void)
{
...char input[10001], output[81];
...int i, cursor = 0;
...gets(input);
...for(i=0; i<10000 || input[i] != '\0' || cursor < 80; i++)
...{
......if(input[i] == '<' && cursor > 0)
.........cursor--;
......else if(input[i] == '>' && cursor < 80)
.........cursor++;
......else
.........output[cursor++] = input[i];
......}
......output[cursor] = '\0';
......printf("%s",output);
......return 0;
}


What's wrong with it?
Re: It said : "Crash (ACCESS_VIOLATION)", so what's wrong with my code?
Posted by botl_ayhan 24 Jan 2006 16:01
Problem says that:"Assume that at the beginning the e-screen contains 80 spaces and the cursor is placed at the first position to the left"
I had the same problem. You must fill the output array with spaces