Write a program that reads a comma-separated file (CSV) with integer values. Your program will take...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that reads a comma-separated file (CSV) with integer values. Your program will take the file name as the input. If the file does not exist, then the program must print. Error: input file not found! And, the program is terminated If the program opens the file successfully, the program will output the number of integers read from the file and store the numbers into an array. The program then accepts a user input integer to specify the number of shifts to the left that need to take place to the array For example, given the following CSV file "input1.csv": 1,22,50,38,6 and a user input integer 2 for shifting, the output of your program must be 5 50 38 6 1 22 Implement a function, left_shift() with return type void, to achieve the above shifting This function will take three parameters as input in the following order. an integer array an integer specifying the size of the array • an integer specifying the number of shifts Your left shift() function will be tested separately via unit tests. You can safely assume that the numbers of integers in the testing csv files are at most 100 NOTE if you hard code the output, you will receive zero for this exercise 1 //Include the proper headers 2 3 using namespace std;; 4 5 //Implement your left shift function below 6 void left shift (int [], int, int); 7 8 int main() 90 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 32738 26 29 X const int MAX _SIZE = 100; int numbers [MAX_SIZE]; string filename; cin >> filename; // Add other variables below // Read from the csv file // Shift the elements in the integer array to the Left by n positions, n is input by the user // Output the number of elements found in the csv file. //Output the shifted integer array. The integers are separated by a space return 0; Write a program that reads a comma-separated file (CSV) with integer values. Your program will take the file name as the input. If the file does not exist, then the program must print. Error: input file not found! And, the program is terminated If the program opens the file successfully, the program will output the number of integers read from the file and store the numbers into an array. The program then accepts a user input integer to specify the number of shifts to the left that need to take place to the array For example, given the following CSV file "input1.csv": 1,22,50,38,6 and a user input integer 2 for shifting, the output of your program must be 5 50 38 6 1 22 Implement a function, left_shift() with return type void, to achieve the above shifting This function will take three parameters as input in the following order. an integer array an integer specifying the size of the array • an integer specifying the number of shifts Your left shift() function will be tested separately via unit tests. You can safely assume that the numbers of integers in the testing csv files are at most 100 NOTE if you hard code the output, you will receive zero for this exercise 1 //Include the proper headers 2 3 using namespace std;; 4 5 //Implement your left shift function below 6 void left shift (int [], int, int); 7 8 int main() 90 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 32738 26 29 X const int MAX _SIZE = 100; int numbers [MAX_SIZE]; string filename; cin >> filename; // Add other variables below // Read from the csv file // Shift the elements in the integer array to the Left by n positions, n is input by the user // Output the number of elements found in the csv file. //Output the shifted integer array. The integers are separated by a space return 0;
Expert Answer:
Answer rating: 100% (QA)
include include include using namespace std const int MAXSIZE 100 void left... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these economics questions
-
There have been four applicants for Maggie's assistant position, and four for David's assistant position. The applicants are as follows: Maggie's assistant position. Applicant 1 - Svetlana Svetlana...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
In this project, we will write a program that controls a quiz show, much like the many popular TV shows. The program will read in a group of questions and their multiple choice answers, storing them...
-
The following list of balances has been extracted from the records of company cowgale co as of 31 October 2017 the end of the most recent financial year. Notes 1. The balance on the corporation tax...
-
Find the horizontal and vertical asymptotes of each curve. Check your work by graphing the curve and estimating the asymptotes. 38. 37. v= r' + 1 39. y 39. 40. y x + 3r - 10 41. h(x) 42. F(x) %3! V4r...
-
What are UNDO-type and REDO-type log entries?
-
Consider the gasoline mileage data in Table B.3. a. Fit a multiple linear regression model relatmg gasoline mileage $y$ (miles per gallon) to engine displacement $x_{1}$ and the number of carburetor...
-
WinCo Foods, a large discount grocery retailer in the western United States, promotes itself as the lowest priced grocery retailer. In newspaper ads WinCo Foods published a price comparison for...
-
Required information Problem 6-2AA (Algo) Periodic: Alternative cost flows LO P3 [The following information applies to the questions displayed below] Warnerwoods Company uses a periodic inventory...
-
Using basic accounting principles as a guide, provide arguments to support The IASB approach for reporting R&D costs, and The ASPE approach for reporting R&D costs. In this era of rapidly changing...
-
Suppose you are considering a purchase of a new car. You have figured out that your budget allows for a monthly payment of 375 for the next three and a half years. And you think that you should be...
-
a. Briefly describe scenario analysis. b. What are its strengths and weaknesses?
-
How may a firms cost of debt be estimated?
-
a. Briefly describe sensitivity analysis. b. What are its strengths and weaknesses?
-
Explain the four steps in capital budgeting financial analysis.
-
What is float?
-
The maximum velocity of a particle performing S.H.M. is 6.28 cm/s. If the length of its path is 8 cm, calculate its period.
-
What exactly is a prima facie duty? How does an ethic of prima facie duties differ from monistic and absolutist ethical theories?
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Jan has two jobs during 2012. One employer withheld and paid FICA taxes on $66,600 of Jan's salary, and the other employer withheld and paid FICA taxes on $44,400 in salary paid to Jan. Calculate the...
-
During the 2012 tax year, Irma incurred the following expenses: Union dues..............................................................$275 Tax return preparation...
-
By using the yield to maturity on AT&Ts debt, we found that its pretax cost of debt is 3.65%. If AT&Ts tax rate is 25%, what is its effective cost of debt?
-
You work in Walt Disney Companys corporate finance and treasury department and have been assigned to the team estimating Disneys WACC. You must estimate this WACC in preparation for a team meeting...
-
You are working for Microsoft evaluating the possibility of selling energy drinks. Microsofts WACC is 8.1%. Energy drinks would be a new line of business for Microsoft, however, so the systematic...
Study smarter with the SolutionInn App