Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is a little C program to copy arbitrary files from standard inpat to standa

ID: 3880185 • Letter: H

Question

Here is a little C program to copy arbitrary files from standard inpat to standard output MP1 by include int main0 I for CS:3620 int ch hile (ch - getchar)EOF) a) Modify this program so that the header comment has your name instead of the dashes shown in the code above. b) Modify it so that it deletes carriage return (VE in C) characters from the input If you carelessly upload a text file from a Windows system, this makes your program useful - it will strip out all of the extraneous carriage returns from the DOS-format line endings e) Modify it so that all control characters other than carriage return and line feed r and 'n) are replaced by two-character sequences consistiag of an by the printing character you get by adding the code for to the code for the coatrol character. For our purposes, control characters are encoded by integer values less than space up-arrow )followed

Explanation / Answer

Given below is the completed code. But please note
1. For task a), your name is needed, since you have not given your name, I have used the word YOUR NAME in the comment line. Please replace it with your name.

/* MPI by YOUR NAME for CS:3620 */
#include <stdio.h>
int main(){
int ch;
while((ch = getchar()) != EOF) {
if(ch == ' ')
; /* do nothing */
else if(ch == ' ') /*newline*/
putchar(ch);
else if(ch < ' ') /* if its a control character */
{
putchar('^');
putchar(ch + '@');
}
else
putchar(ch);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote