Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I. Read input integers from a file into an array A; there will be up to 500 elements. Then fill two new arrays with elements

image text in transcribed

I. Read input integers from a file into an array A; there will be up to 500 elements. Then fill two new arrays with elements selected from A as indicated below Array A13 will contain all the elements of A that are multiples of 13. Array Aeven will contain all the elements of A that are even integers. Output the contents of these arrays, with labels, to a file. Also output the number of elements in each array 2. Lab Assignment: Declare an array of C-strings to hold course names, and read in course names from an input file. Then do the output to show each course name that was read in. See Chapter 8 section on "C-Strings", and the section "Arrays of Strings and C-strings", which gives an example related to this lab. Declare the array for course names as a 2-D char array: char courseNames[ 10][50]; (allows for 10 courses and up to 49 characters in a course name) each row will be a C-string, and you can use it by writing courseNames[i] as if the array were one-dimensional! Use infile.get(courseNameslil], 50); for reading C-string data row-by-row; the get function will put in the null character after the input data for you. Note: The.get function reads characters into the array across an input file line, until it encounters a newline character. It does not remove the newline character from the input stream, so in order to read the next line, your program must do that. The textbook suggests declaring char discard; and using infile.get(discard); to read the newline character into the variable discard

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago