You should write a single program, part2.c, for all steps of this part. You should probably keep a working back-up each time you progress to a new step.
The steps become harder, with less hints, as you progress. If you are running out of time, don't try to complete all steps - instead get everything marked that you can by the deadline, and try to prepare better for the next lab exercise. (Ensure that you use submit to prove that you finished in time.)
Write a C program to read characters one-by-one from standard input (you can use ctrl-D to terminate the input), convert all upper-case characters to lower-case and all lower-case characters to upper-case, and write the result to standard output e.g.:
You should also count how many characters you have read, and how many of those you have converted in each direction, and output the totals at the end e.g.:
Read 13 characters in total, 8 converted to upper-case, 2 to lower-case
You will need to use getchar and putchar for the individual characters, as well as printf for the final character counts.
You may want to use some of the functions in ctype.h, such as tolower and isupper (e.g. use man ctype.h or look in Standard C).
Edit your program so that the input is read from a file opened from within your program. For the time being, you can use a fixed file-name such as "input".
Hint: Stream Manipulation
Remember to check that the file is correctly opened. Test this by running the program when there is no input file available.
Hint: refer to man fopen and SalaryAnalysis.c
Edit your program so that the output is written to a file, using a fixed file-name such as output.
Remember to check that the file is correctly opened. Test this by running the program when a file of that name exists, but is write protected e.g. chmod u-w output
Edit your program so that, instead of using fixed filenames such as "input" and "output", both file-names are read from standard input when the program is run (i.e. use scanf or similar; I don't want you to use command-line parameters).
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.#include <stdlib.h>
char c, fileName;
int count = 0, lower = 0, upper = 0;
FILE *fp, *op; //File pointers
printf("Please enter in the input file name: "); //Prompt
scanf("%s", fileName); //Read in string for fileName
fp = fopen(fileName, "r");...
By purchasing this solution you'll be able to access the following files: