Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need someone to solve these assignment C++ mydata.txt 24.750 89.450 98.520 523.654 79768.300 2692.567 6786543.700 4263.970 95720.280 36591.300 63.970 9511.500 12792.500 441.829 12.390 5974.172

I need someone to solve these assignment C++

mydata.txt

24.750 89.450 98.520 523.654 79768.300 2692.567 6786543.700 4263.970 95720.280 36591.300 63.970 9511.500 12792.500 441.829 12.390 5974.172

Requirements

1. You will need to create a new file (you can do this in the file system make it plain text) and call it mydata.txt. I have already created it for you here. 2. There is a column of numbers in the text file that you must read into your array. Pay attention to type make sure they have all the decimal places shown. 3. Based on the examples in the slides (L3) and the textbook, write a C++ program, include iostream and fstream. You might need iomanip. 4. Your program should read the numbers from the file and store them in a vector or an array of the appropriate type. Your vector or array should be able to hold up to 35 values, but there might be 35 or fewer in the file, so keep track of how many you read from the file. 5. Next, write a loop to process the vector or array in reverse order. In the loop do the following: i. Before you enter the loop, put a title at the top of the console showing the label(s) for your data. ii. In the loop. print each number in the array to the console in reverse order. iii. Calculate the following using the numbers in the array. ``` 1. Start with 100,000.00 in your answer variable of the correct type. a. Multiply the answer variable by the first number in the array. Print the data from this step. answer = answer x array element b. Then calculate the remainder of the answer variable divided by the second number in the array. Then divide the answer by this remainder. IMPORTANT: If the remainder is zero, skip this step. Print the data from this step. answer = answer / remainder(answer/next array element) c. Keep alternating step a and b until your have used all the elements in your array. ``` 7. Print the final answer at the bottom of your program just before the closing message. Clearly label this answer. ``` Sample output: Multiplication: 100000.00 x 24.750 = 2475000 Division by remainder: 2475000 / 219978 (remainder of 2475000/89.450) = 11.25112511 Multiplication: 11.25112511 x 98.520 = 1108.460846 Division by remainder: 1108.460846 / ? (remainder of 1108.460846/523.654) = ? etc. ```

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions