Write a C Program that:
- Creates an input file (input.txt)
- Take user inputted integer for number of lines in the input file
- accepts inputted text from command line to the input file (input.txt)
- saves and closes file. (input.txt)
- reopens and displays the newly inputted contents of the file
#include <stdio.h>
#include <stdlib.h>
int main() {
int i, n, num;
FILE *fp = fopen("input.txt", "w");
printf("How many numbers: ");
scanf("%d", &n);
printf("Enter %d integers: ", n);
for (i = 0; i < n; ++i) {
scanf("%d", &num);
fprintf(fp, "%d\n", num);
}
fclose(fp);
fp = fopen("input.txt", "r");
while (fscanf(fp, "%d", &num) != EOF) {
printf("%d\n", num);
}
fclose(fp);
return 0;
}
Write a C Program that: - Creates an input file (input.txt) - Take user inputted integer...
Write a C++ program that reverses a file. More specifically, given an input file (input.txt) your program will reverse every line in the input. This program does not have an output file, as it modifies the input file directly. You may assume that your input file has 1000 lines or less, if this helps. sample input: Hello World! I study C++ following output: !dlroW olleH ++C yduts I
Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program...
java Program
Write a program called Copy that accepts the names of an input file and an output file on the command line and copies the contents of the input file to the output file, for example, csc$ java Copy infile.txt outfile.txt
Write a program that reads a file named input.txt and writes a file that contains the same contents, but is named output.txt. The input file will contain more than one line when I test this. Do not use a path name when opening these files. This means the files should be located in the top level folder of the project. Do not use a copy method that is supplied by Java. Your program must read the file line by line...
use PYTHON Write a program that will take an input file called input.txt which will contain a Java program and parse it and output an annotated version. Your program will track the nesting depth of the braces of the input file and will output an annotated version of the file. Your final program will 1. List the nesting depth of curly braces 2. Ignore braces inside quotes or comments Use Python Assume that all quoted strings begin and end on...
java
Write a program called Copy that accepts the names of an input file and an output file on the command line and copies the contents of the input file to the output file, for example, csc$ java Copy infile.txt outfile.txt
//Done in C please!
//Any help appreciated!
Write two programs to write and read from file the age and first
and last names of people. The programs should work as follows:
1. The first program reads strings containing first and last
names and saves them in a text file (this should be done with the
fprintf function). The program should take the name of the file as
a command line argument. The loop ends when the user enters 0, the...
C++ (1) Write a program to prompt the user for an input and output file name. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs. For example, (user input shown in caps in first line, and in second case, trying to write to a folder which you may not have write authority in) Enter input filename: DOESNOTEXIST.T Error opening input file: DOESNOTEXIST.T...
Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...
Write a program which will take a list of integer number from the user as input and find the maximum and minimum number from the list. First, ask the user for the size of the array and then populate the array. Create a user define function for finding the minimum and maximum numbers. You have to use pointer variables for solving the problem. Finally, you need to print the entire list along with the max and min numbers ALSO NEED:...