Write a program that sequentially displays on screen the contents of all of the
ID: 3667790 • Letter: W
Question
Write a program that sequentially displays on screen the contents of all of the files listed in the command line. Use argc to control a loop.
Write a program that creates a structure template with the following data fields. The program should then prompt the user to enter the data to populate the structure. Finally, use printf() to display the information entered by the user.
Account number
Account owner street address (string)
Account owner city/state (string)
Account owner zip code
Account balances
Account credit limit
Account name
Write a program that converts a user entered temperature in Fahrenheit to Celsius incorporating three modules and functions named as identified below. The user entered Fahrenheit temperature is to be passed as an argument to the function named convert() in the module "conversion.c". The calculated Celsius value is to be return by the function and the result displayed to the user in the function main() :
convert_driver.c - contains the function main() and the user interface
conversion.h - contains the prototype for a function named convert()
convertsion.c - contains the function definition for convert()
Write a calculator program that adds and subtracts. Prompt the user to enter two values and select an operation to perform. Incorporate a program with five modules and functions named as follows:
calc_driver.c - contains the function main() and the user interface
addition.h - contains the prototype for a function named add()
addition.c - contains the function definition for add()
subtraction.h - contains the prototype for a function named subtract()
subtraction.c - contains the function definition for subtract()
Explanation / Answer
1)
#include <stdio.h>
#include <strings.h>
void main(int argc, char *argv[])
{
FILE *viewfile;
char buffer[81];
while (argc>1)
{
viewfile=fopen(argv[1], "r");
while(fgets(buffer,80,viewfile))
{
printf("%s", buffer);
fclose(viewfile);
}
argv[1]++;
}
exit(0);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.