Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please complete the following C++ program using Visual Studio. There are three lab problems. solve for each of them separately and make sure it runs

Please complete the following C++ program using Visual Studio. There are three lab problems. solve for each of them separately and make sure it runs well. for Lab 3 just make sure the code has no error and I will run after I saved text file.

Lab Assignment 19 - Arrays

  1. Program a new program called Lab19A

Declare the array below in your program. Then, find and print the last odd integer in the array.

int array1 [ ] = {1, -2, -1, 2, 8, 9, -51, 6, 9, 24, 0, 2, -25};

2. Program a new program called Lab19B

  • Declare an array of 10 integers and set each value in the array equal to 5 times its index.
  • Print the array all on one line separated by spaces.
  • Add up all the array elements and print the total.

  1. Program a new program called Lab19C that searches for a number in an array.
    1. Include a void function with an int array as a parameter that reads the values from a text file (Lab19C.txt) and places the values in the array.
    2. Include a bool function that receives 3 parameters: an int array, the array length, and an int number. Return true if the number is in the array and false otherwise.
    3. In the main function, declare an array of 20 integers.

Call the function to populate the array, and then print the array (on one line separated by spaces).

Ask the user for a number to search for in the array and call the function to search for it. Using the returned value print a statement to say if the number is found or not.

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

Students also viewed these Programming questions