akosiraff

Download Stack Queue FileRead

Apr 4th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1.  
  2.  
  3.  
  4. Download: http://solutionzip.com/downloads/stack-queue-fileread/
  5. The program will get the name of a .txt file from the user. It will open the file and read in data one item at a time. It will be looking for integers, in the file, that are between 0-99.
  6. When the program does a read, if the number read is between 0-49, the program will PUSH it to a STACK.
  7. When the program does a read, if the number read is between 50-99, the program will PUSH it to a QUEUE.
  8. If the data is invalid (such as an integer less than 0 or greater than 99, or if the data is a word or character) the program will discard that data and move on to the next read.
  9. The program needs to look for the end of file (EOF) to determine when it is done reading data.
  10. Once the reads are complete, the program will POP the data off of the STACK and write the data, ONE ITEM PER LINE THEN SKIP A LINE AND SUM THE TOTAL, to a .txt file named “stack.txt”.
  11. Once the reads are complete, the program will POP the data off of the QUEUE and write the data, ONE ITEM PER LINE THEN SKIP A LINE AND SUM THE TOTAL, to a .txt file named “queue.txt”.
  12. The program will need FUNCTIONS to do the following:
  13. A function that gets the name of the .txt file to open from the user
  14. A functions that reads the data from the file and evaluates if the data to be sorted
  15. A function that PUSHES data to the STACK
  16. A function that PUSHES data to the QUEUE
  17. A function that creates a .txt file named stack.txt and writes the data from the STACK and the sum in the file
  18. A function that creates a .txt file named queue.txt and writes the data from the QUEUE and the sum in the file
  19. A function that will open and display both .txt files that were created to the user at the CONSOLE
  20. USE ERROR CHECKING!
  21. Download: http://solutionzip.com/downloads/stack-queue-fileread/
Add Comment
Please, Sign In to add comment