Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Quick assistance
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Dante




PostPosted: Tue Apr 19, 2011 6:10 pm   Post subject: Quick assistance

What is it you are trying to achieve?

Write a procedure called reverseFile that accepts the names of two text files. The first should be an existing text file that will be reversed (line by line) to form the second text file. Include reversed line numbers in the output text file. (Hint: you will have to open and close the input file several times).

What is the problem you are having?

Can't seem to get it...This should be simple, but it's really puzzling me. :$



Turing:

proc reverseFile (file1, file2: string)

    var stream1, stream2: int
    var sWord : string
    var count : int := 0


    open : stream1, file1, get
    open : stream2, file2, put


    loop
        get : stream1, skip
        exit when eof (stream1)
        get : stream1, sWord : *
        put : stream2, sWord
    end loop
   
   
   
   
   
   
   
   

    close : stream1
    close : stream2


end reverseFile





Embarassed Embarassed Embarassed Embarassed
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Apr 19, 2011 7:25 pm   Post subject: Re: Quick assistance

Dante @ Tue Apr 19, 2011 6:10 pm wrote:
(Hint: you will have to open and close the input file several times).
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dante




PostPosted: Tue Apr 19, 2011 7:37 pm   Post subject: Re: Quick assistance

Tony @ Tue Apr 19, 2011 7:25 pm wrote:
Dante @ Tue Apr 19, 2011 6:10 pm wrote:
(Hint: you will have to open and close the input file several times).



Errrm. The farthest I can go with this thus far is :


Edit: Finally got this figured out. Wasted too much time on this question lol. Thanks for replying though Razz
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: