1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
adelina 88 [10]
3 years ago
15

You will create an array manipulation program that allows the user to do pretty much whatever they want to an array. When launch

ing the program, the user will pass in a file name that contains a set of value and an int that informs the program how many values are in the file (see example below) Check to see if the file could be opened. Exit the program if it was not opened, otherwise continue Create an array and fill it with the values from file Present the user with a menu, detect their choice, and provide them any needed follow up prompts that are needed. Continue until they want to quit

Engineering
1 answer:
enyata [817]3 years ago
3 0

Answer:

Check the explanation

Explanation:

#include <iostream>

using namespace std;

void insert(int* arr, int* size, int value, int position){

if(position<0 || position>=*size){

cout<<"position is greater than size of the array"<<endl;

return ;

}

*size = *size + 1 ;

for(int i=*size;i>position;i--){

arr[i] = arr[i-1];

}

arr[position] = value ;

}

void print(int arr[], int size){

for(int i=0;i<size;i++){

cout<< arr[i] <<" ";

}

cout<<" "<<endl;

}

void remove(int* arr, int* size, int position){

* size = * size - 1 ;

for(int i=position;i<*size;i++){

arr[i] = arr[i+1];

}

}

int count(int arr[], int size, int target){

int total = 0 ;

for(int i=0;i<size;i++){

if(arr[i] == target)

total += 1 ;

}

return total ;

}

int main()

{

int size;

cout<<"Enter the initial size of the array:";

cin>>size;

int arr[size],val;

cout<<"Enter the values to fill the array:"<<endl;

for(int i=0;i<size;i++){

cin>>val;

arr[i] = val ;

}

int choice = 5,value,position,target ;

do{

cout<<"Make a selection:"<<endl;

cout<<"1) Insert"<<endl;

cout<<"2) Remove"<<endl;

cout<<"3) Count"<<endl;

cout<<"4) Print"<<endl;

cout<<"5) Exit"<<endl;

cout<<"Choice:";

cin>>choice;

switch(choice){

case 1:

cout << "Enter the value:";

cin>>value;

cout << "Enter the position:";

cin>>position;

insert(arr,&size,value,position);

break;

case 2:

cout << "Enter the position:";

cin>>position;

remove(arr,&size,position);

break;

case 3:

cout<<"Enter the target value:";

cin>>target;

cout <<"The number of times "<<target<<" occured in your array is:" <<count(arr,size,target)<<endl;

break;

case 4:

print(arr,size);

break;

case 5:

cout <<"Thank you..."<<endl;

break;

default:

cout << "Invalid choice..."<<endl;

}

}while(choice!=5);

return 0;

}

Kindly check the attached images below for the code output.

You might be interested in
Casein, a dairy product used in making cheese, contains 25% moisture when wet. A dairy sells this product for $40/100 kg. If req
Nataly_w [17]

Based on the percent moisture content of the dried product, the mass of dried casein produced os 852.3 kg.

<h3>What is the mass of casein in wet casein?</h3>

The mass of casein in 1000 Kg of wet casein is 75% 1000 kg = 750 Kg

Mass of water 250 kg

The mass of casein is constant while the moisture content can be changed.

At 12% moisture content;

750 kg = 88%%

100 % = 100 ×750/88 = 852.27 kg

Therefore, the mass of dried casein produced os 852.3 kg.

Learn more about mass at: brainly.com/question/24658038

#SPJ1

3 0
2 years ago
Please write the following code in Python 3. Also please show all output(s) and share your code.
maksim [4K]

Answer:

sum2 = 0

counter = 0

lst = [65, 78, 21, 33]

while counter < len(lst):

   sum2 = sum2 + lst[counter]

   counter += 1

Explanation:

The counter variable is initialized to control the while loop and access the numbers in <em>lst</em>

While there are numbers in the <em>lst</em>,  loop through <em>lst</em>

Add the numbers in <em>lst</em> to the sum2

Increment <em>counter</em> by 1 after each iteration

6 0
3 years ago
A plate and frame heat exchanger has 15 plates made of stainless steel that are 1 m tall. The plates are 1 mm thick and 0.6 m wi
hodyreva [135]

Answer:

14.506°C

Explanation:

Given data :

flow rate of water been cooled = 0.011 m^3/s

inlet temp = 30°C + 273 = 303 k

cooling medium temperature = 6°C  + 273 = 279 k

flow rate of cooling medium = 0.02 m^3/s

Determine the outlet temperature

we can determine the outlet temperature by applying the relation below

Heat gained by cooling medium = Heat lost by water

= ( Mcp ( To - 6 )  =  Mcp ( 30 - To )

since the properties of water and the cooling medium ( water ) is the same

= 0.02 ( To - 6 ) = 0.011 ( 30 - To )

= 1.82 ( To - 6 ) = 30 - To

hence To ( outlet temperature ) = 14.506°C

6 0
3 years ago
B/ Evaluate e^(πi/2)
ivanzaharov [21]

Explanation:

≈4.8

There really isn't an elegant way to express it. Just plug and chug for irrationals raised to other irrationals.

8 0
2 years ago
Read 2 more answers
What is the locating position of the land field?​
Ivahew [28]

Any point on earth can be located by specifying its latitude and longitude, including Washington, DC, which is pictured here. Lines of latitude and longitude form an imaginary global grid system, shown in Fig. 1.17. Any point on the globe can be located exactly by specifying its latitude and longitude.

4 0
2 years ago
Other questions:
  • 2.4: Add a method called setValue(), and the description of setValue is: public int setValue(long searchKey) In this method, the
    13·1 answer
  • Q: Draw shear and bending moment diagram for the beam shown in
    5·1 answer
  • Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of the selling price. Write an in
    9·1 answer
  • WHAT IS THE MOST POWERFUL PART IN A CAR
    13·2 answers
  • How can you drop two eggs the feweHow can you drop two eggs the fewest amount of times, without them breaking? ...st amount of t
    13·2 answers
  • A large building will need several different types of workmen to install and repair pipes for water, heating,
    10·1 answer
  • If most wildfires are suppressed (all fires are put out) for many years, how does the risk of wildfire in the area change in the
    10·1 answer
  • What document should you have from the engine manufacturer when working on an engine
    8·1 answer
  • Wireless technology has made communicating
    15·1 answer
  • Select the correct answer.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!