I/O program for C
Write a program in direct1.c which reads from standard input a line and then outputs that line immediately to standard output. it should read the first line only !
Then, write another program called direct2.c which reads from standard input every line until end of input and outputs them to standard output. Everything that goes in should come out exactly as it was.
Compile both programs and run them on the input files given below
The direct1 program should be run, redirecting input1.txt to standard input and redirecting output to output1.txt.
The direct2 program should be run, redirecting input2.txt to standard input and redirecting output to output2.txt.
Please write two programs direct1.c and direct2.c
Contents of
Input1.txt
Hi what is your name.
What What what What what
Contents of Input2.txt
The quick brown fox
jumps over the lazy dog
The lazy dog jumps over the quick brown fox.
So , output1.txt should display- Hi what is your name, (not all the whats below that)
On output2.txt , it should display
The quick
brown fox jumps over the lazy dog
The lazy dog jumps over the quick brown fox. (Entire document
until end of line)
Please also write linux command for I/O redirection as mentioned in question . If you know only though .
/**The sample c++ that prompts user to enter
a text until user press a enter key and print
the text to console.*/
//code.cpp
#include<stdio.h>
#include<conio.h>
#define MAX 255
int main()
{
char letters[MAX]={0};
int i = 0, c;
FILE *file;
file=fopen("output1.txt","w");
printf ("Enter a line and press Enter key: ");
/*Read text from user until user press enter*/
while (i + 1 < MAX && (c = getchar()) != '\n')
letters[i++] = c;
//terminate the letters last char with null
letters[i] = '\0';
printf ("String entered: %s\n", letters);
//write the letters to console
fprintf (file,"%s", letters);
//close the file
fclose(file);
//pause program output on console
getch();
return 0;
}
Sample Ouptut :


---------------------------------------------------------------------------------------------------------------------------------------
/**The sample c++ that prompts user to enter
a text until user press . to stop reading input
and then text
write to output2.txt .*/
//code.cpp
#include<stdio.h>
#include<conio.h>
#define MAX 1024
int main()
{
char letters[MAX]={0};
int i = 0, c;
FILE *file;
file=fopen("output2.txt","w");
printf ("Enter a line and press Enter . to stop: ");
/*Read text from user until user press cntl+Z from
keyboard*/
while (i< MAX && (c = getchar()) != '.')
letters[i++] = c;
//terminate the letters last char with null
letters[i] = '\0';
printf ("String entered: %s\n", letters);
//write the letters to console
fprintf (file,"%s", letters);
//close the file
fclose(file);
//pause program output on console
getch();
return 0;
}
Sample Output :


I/O program for C Write a program in direct1.c which reads from standard input a line...
-Write in C++ language.
-Brief description of the program: - input(s) and output(s) - brief description or relationship between inputs and outputs Submission Instructions: Submit only.c files in the designated Dropbox on D2L Problem 1 (25 points): Write a C program that a) reads one line (sentence) at a time from a text file called inputtext.txt (on D2L), b) reverses the words on that line, c) prints (on the screen) the modified line and d) write the modified line in...
Python 3:Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order An example file along with the correct output is shown below: example.txt the quick brown fox jumps over the lazy dog Enter the input file name: example.txt brown dog fox jumps lazy over quick the
Write a Python program to find the list of words that are longer than n from a given list of words and append it into a new list. Print the new list in the end. ***You have to take the list as input from the user. Sample Input: list = [“The”, “quick”, “brown”, “fox”, “jumps”, “over”, “the”, “lazy”, “dog”] n = 3 Sample Output: [“quick”, “brown”, “jumps”, “over”, “lazy”]
In C language This program reads in a series of words. All words consist of only lower-case letters ('a' through 'z'). None of the words entered will be longer than 50 letters. The program reads until ctrl-d (end-of-file), and then prints out all the lower-case letters that were missing in the input or a statement indicating the input has all the letters. Two executions of the program are shown below. Enter your input: the quick brown fox jumps over the...
Please solve. How do I create my own text file? Where do I save it so that it is recognized by python? Do I have to import it into my code? the prompt: Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. An example file along with the correct output is shown below: example.txt the quick brown fox jumps over the lazy dog Enter the input file name:...
Simple Python Program Working with strings Write a Python program to read in a number of strings from the user. Stop when the user enters “Done”. Then check if each of the strings contains all the letters of the alphabet. Print the results in the form of a dictionary, where they keys are the strings and the values are the Truth Value for the string, which you just calculated. Sample Run: Enter the strings: taco cat The quick brown fox...
Write a program using regular expression to find the starting and ending locations of ‘fox’ in the text 'The quick brown fox jumps over the lazy dog.' Then print out its locations as follows: Found fox from (the starting location) to (the ending location).
Using the website Repl.it Write a Java program that can perform the Caesar cipher for English messages that include both upper and lowercase alphabetic characters. The Caesar cipher replaces each plaintext letter with a different one, by a fixed number of places down the alphabet. The program should be able to shift a specific number of places based on the user's input number. For example Plaintext: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. Ciphertext: QEBNRFZH YOLTK CLU GRJMP...
C++ Write a MyString class that stores a (null-terminated) char* and a length and implements all of the member functions below. Submit your completed source (.cpp) file. Default constructor: empty string const char* constructor: initializes data members appropriately Copy constructor: prints "Copy constructor" and endl in addition to making a copy Move constructor: prints "Move constructor" and endl in addition to moving data Copy assignment operator: prints "Copy assignment" and endl in addition to making a copy Move assignment operator:...
Write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates. Ex: If the input is: inputl.csv and the contents of input1.csv are: hello, cat, man, hey, dog, boy, Hello, man, cat, woman, dog, Cat, hey, boy the output is: hello 1 cat 2 man...