Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Only one source code file as follows with filename as in the example: firstname_lastname_prj1_sectnn_src.c (or .cpp) a) At top of the file: your name

1) Only one source code file as follows with filename as in the example: firstname_lastname_prj1_sectnn_src.c (or .cpp) a) At top of the file: your name in comments, for example: // First_Name Last_Name b) Next, the gcc or g++ code compilation and linkage command, for example: // gcc -o cpfile.c -o cpfile.exe c) in-line code comments no fewer than every 5 lines of code which describe your algorithmic steps. Syntax transcriptions of the code are not consider in-line code comments! (For example, I do not want to see the comment for i++ which says "Increment i.") 2) The source code accepts one command line argument which is the name of the input file to be read (input files to be provided by instructor). 3) An MS Word or PDF document with a write-up of your software design and an explanation of the issues encountered and resolved. (1 page) Filename should be according to this example: firstname_lastname_prj1_sectnn_wrt.doc (or pdf) 4) An ASCII text results file containing your output from executing your program twice (once for each of the two input files). Filename should be according to this example: firstname_lastname_prj1_sectnn_out.txt Project Description ------------------- 1) Your program will make use of the POSIX system I/O calls discussed in lectures. That is, you MUST only use open(), close(), read(), write(), lseek(). 2) You are NOT permitted to use any C++ nor C standard I/O library functions nor cin nor cout. Furthermore, you cannot use any C++ nor C standard library functions for string oeprations. 3) You are NOT permitted to reference nor use the size of the input file in your program. 4) Your program will do the following three actions simultaneously after having opened the input text file: a) Read the input file from the beginning of the file to the end of file, character by character. You may only use one character array for storing the characters with maximum array size of 32 (regardless of input file size). b) Read the input file in reverse, that is, backwards from the end of the file, character by character. You may only use one character array for storing the characters with maximum array size of 32 (regardless of input file size). c) Compare each character read from part (a) with that from part (b). If they are the same then print to the screen a zero, otherwise print 1. NOTE: 5) ONLY after you finally exhaust the input file contents, you will print a newline character to the screen. 6) Afterwards, you will print: a) The position and actual characters that differ as shown in the example below. b) The total number of characters that differ as shown in the example below. 7) Please use your own input files. Program execution example: Compare the first character in the file with the last character in the file. Compare the second character in the file with the next to last character in the file.\ Compare the third character in the file with the next to next to last character in the file. And so on.... Consider if the input file has the following text: abcdefdcbx You will print out to the screen the following: 1000110001 1 a x 5 e f 6 f e 10 x a Total: 4 character positions differ 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions