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

Write a program to get input and output file names from user. Open the file, rea

ID: 665923 • Letter: W

Question

Write a program to get input and output file names from user. Open the file, read each file from the file and write the line you read to an output file along with the length of line.

Example:

InputFile contents:

Hello world

Test

MAC102

C++ programming

Output file contents: (Your program should generate similar outputfile)

Hello world - Length:11

Test - Length:4

MAC102 – Length:6

C++ programming – Length:15

Explanation / Answer

/* * Prompt user for two integers and print their sum, difference, product and quotient * (IntegerArithmetic.cpp) */ #include using namespace std; int main() { int firstInt; // Declare a variable named firstInt of the type int (integer) int secondInt; // Declare a variable named secondInt of the type int int sum, difference, product, quotient; // Declare 4 variables of the type int to keep the results cout > firstInt; // Read input from keyboard (cin) into firstInt cout > secondInt; // Read input into secondInt // Perform arithmetic operations sum = firstInt + secondInt; difference = firstInt - secondInt; product = firstInt * secondInt; quotient = firstInt / secondInt; // Print the results cout
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