Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please write a C++ code that reads a file called data.txt that displays integers like the image below then solve the two peoblems using the

please write a C++ code that reads a file called data.txt that displays integers like the image below
then solve the two peoblems using the data.
image text in transcribed
image text in transcribed
[253,676114] [527 160, 277] [364, 193.169] [246,651,378] [536,479,695] [569,548.83] [117, 387,543] [294 753,702) (651,296, 284] [600,498, 114] [201, 260,629] [686,473,375] [234,727, 891 [447, 83.730] [521.591 300] [279,405, 227] [686, 101, 448] [559,602,283] [75, 137, 170] [430, 136,527] [111, 259,219] [280.217.707] [433, 437, 1941 [165,359,643] [398,463,614] [352, 511, 242) [413:306,751] [443.281, 540] [81:362,548] [407.706, 513] [150, 632, 367] [616.575,393] [701.172,545) 1311, 207, 284) 1210,659,535] [355,587,583] [151,461.79] [742, 484.279] [695, 127.91] [699.88, 550] (653, 80,346] [493.573.105] [529,345,372] [393,530, 164] [756,627, 735) [476,384, 433] 1706,300,577) 1378,591,402] [206.161, 523] [709,254,588] [393, 256.230) [344.673,676] [725, 463.227) [522,719,636] Project 2 Description. The goal of this project is to familiarize ourselves with file and string data types in C++. As a source of data in this project you will use the file data.txt. Download it, along side the project description, from Blackboard. This file contains 3 integers per line, separated by a comma. Each such line of integers is enclosed inside square brackets. See the file for more details. Your complete project will include a single main function, in which you call functions problem1() and problem20), where each such function solves the problem with the same name. Solve each problem in order they are listed below. The two functions probleml) and problem20) can either be defined/located above the main function of below it. Your main function must look like this int main() { strings - "data.txt"; problemi(s); problem2(s); return 0; } Problems Problem 1. Write a function, called problem 1() which takes a file name, ie, data.txt, on input. The func- tion reads the data contained in the file and prints to screen the average value of all integers contained in the file. Note, not just per line but all integers in the file. 25 Points) Problem 2. Write a function, called problem20) which takes a file name, ie, data.txt, on input. The function reads the data contained in the file and prints to screen two integer values, separated by a comma, denoting the smallest integer in the data file and the largest integer in the data file. (25 Points

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions