Skip to main content

CS 222 Homework Assignment 6 ASCII File I/O

Introduction

For this assignment, you will perform basic ASCII file Input and Output. Your program will read a series of questions from an input file, present them to the user, get the user's responses to the questions, and write both the questions and the responses to an output file.

Specifications

You program will begin by prompting the user to enter two filenames. The first filename will be the input file that contains the questions. The second filename will be the output file where the questions and responses will be written. Once the filenames are known, the program will open the two files, one for input and one for output.

Your program will then enter a loop which will read each question from the input file, print the question to the console, and get the user's response to the question from the console. It will then write both the question and response to the output file. Your program will continue to do this until there are no more questions to be read from the input file. It will then close both files and exit.

You may assume that no question in the input file will be longer than 80 characters, and that there will be no user response longer than 80 characters. Your program will handle errors gracefully, such as when the input file doesn't exist, or there is an issue opening the output file. In these cases, you will print an error message to the console and exit the program. Your source code file will follow the standard file naming conventions found in earlier labs (HW6_username.c).

Testing and Submitting:

Test your program on Zeus to make sure it compiles and runs properly in various types of cases. Perform proper error checking. A file containing questions, questions.txt, is included as part of this homework assignment. Use this file for testing.Create a Makefile to compile the program. (Tip: It is usually easier to copy and modify an existing Makefile than creating one from scratch.)Place your source code, the questions.txt file and Makefile in a directory specifically created for Homework 6. This directory name will also follow standard naming conventions. Then create a typescript showing that you are currently logged into zeus, that your program can be compiled using the Makefile, and then perform a run of the program, using output.txt for the name of the output file.Create a tarfile of your directory that contains the typescript, your source code and Makefile, and the input and output files.


Buy now

Comments

Popular posts from this blog

The Zoo Management System - entity relationship diagram & MS Access Database

Zoo Management System - Project Details: You are the employee of a big, worldwide working Zoo Management Company. Your company is responsible for the Zoo management. Your boss thinks it would be a great idea to store all data for each Zoo in a brand new self-developed ZOO Management System. Up to now, the ZOO management company has maps of each ZOO available. Your boss knows that you took a course in introduction on an ERP system, so he asks you if you could help designing such a system. Each ZOO must have the same organizational structure, which should look like this: Each Zoo has a Zoo-Address. Each Zoo has many visitors (Visitor Ticket Process (VTP). Many Zoo-Attractions belong to a Zoo. Module 1: Entity Relationship Diagram Design a ER (entity-relationship) diagram for your ZOO Management System. Use the information provided below with the entities and its attributes. Put the entities in the correct relationship to each other (organizational structure). Module 2: DB Implem...

Human Physiology by Stuart Ira Fox [PDF] (12th edition) free download

Sudoku Game Project in Java with full source code including GUI task

Introduction The purpose of the project is to try in practice the use of recursion and object-oriented program design. Please make sure to read this entire note before starting your work. Pay close attention to the sections on deadlines, deliverables, and exam rules. The problem Your task in this part of the project is to write a solver for Sudoku puzzles. Sudoku puzzles are a kind of crossword puzzles with numbers where the following two conditions have to be met: In each row or column, the nine numbers have to be from the set [1,2,3,4,5,6,7,8,9] and they must all be different.  For each of the nine non-overlapping 3x3 blocks, the nine numbers have to be from the set [1,2,3,4,5,6,7,8,9] and they ust all be different. The following two figures show a Sudoku puzzle and its solution. The input The input of your program, the Sudoku puzzles, is given in text files. More specifically, they are represented as nine lines of nine characters separated by spaces. The characters can be of two...