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]
4 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]4 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
What are the conditions for sheet generator to build up its voltage?
MA_775_DIABLO [31]

Answer:

There are six conditions

1. Poles should contain some residual flux.

2. Field and armature winding must be correctly connected so that initial mmm adds residual flux.

3. Resistance of field winding must be less than critical resistance.

4. Speed of prime mover of generator must be above critical speed.

5. Generator must be on load.

6. Brushes must have proper contact with commutators.

Explanation:

3 0
3 years ago
Find the volume of water displaced and position of center of buoyancy for a wooden block of width 2.5m and of depth 1.5m. When i
Lostsunrise [7]

Answer:

The mass density of a fluid is 980 kg/m3. ... If the specific gravity of a liquid is 0.79, determine its mass density and specific ... A wooden block of size 1m x 0.5m x 0.4m is floating in water with 0.4 m side ...

Explanation:

Credit to  sugantipandit7

https://brainly.in/question/43010943?tbs_match=3

4 0
3 years ago
An injector pressure drop test to see if the injector is restricted with deposits can be done using an?
Vitek1552 [10]

An injector pressure drop test to see if the injector is restricted with deposits can be done using an integer test.

<h3>What is injector strain drop?</h3>

Fuel injectors have a glide charge. This glide charge of the injector is rated at a sure strain drop throughout the injector. Meaning the injector glide is say 30#/hr at 42.five PSI. This approach that that injector will glide 30#/hr so long as the strain on the deliver side, minus the strain withinside the manifold is 42.five psiListening or Clicking Test.

Start the engine and permit it to idle. Keep the engine strolling and contact the give-up of a protracted steel screwdriver towards the gas injector. Put your ear on the alternative give up of the screwdriver. A clicking sound approaches the injector's working.

Read more about the injector pressure drop:

brainly.com/question/12385665

#SPJ1

6 0
2 years ago
The tip of the tool should be aligned with the spindle centerline.
prisoha [69]

Answer: True

Explanation:

6 0
4 years ago
When it is 2 PM Mountain Standard Time (MST) on February 3 in North Platte, NE(L = 101◦ W, φ = 41.1◦ N), what is the solar time?
barxatty [35]

Solar time for

North Platte is 13.02

Boise is 13.02

Eastern daylight time is 12.48

Central daylight is 12.06

<u>Explanation:</u>

  • 6 hours "central standard time" is the standard time zone. The saving time of daylight is + 1 hour. current time zone is the 5 hours central daylight time.
  • 7 hours is the mountain standard time. The saving time of daylight is + 1 hour. current time zone is the 6 hours central daylight time.
  • 5 hours is the eastern daylight time. The time shifts to +1 hour forwarded to eastern daylight zone and GMT is behind 4 hours.
  • 5 hours is the central daylight time. The GMT is behind 5 hours during summer season

3 0
3 years ago
Other questions:
  • generally compound curves are not filtered recommended for A. Road B. water way C. underground road D. rail way​
    12·1 answer
  • For the R function shown below(Attachment):
    5·1 answer
  • 3/194 The assembly of two 5‐kg spheres is rotating freely about the vertical axis at 40 rev/min with θ = 90°. If the force F whi
    9·1 answer
  • After a capacitor is fully chargerd, a small amount of current will flow though it. what is this current called?
    14·1 answer
  • before adjusting drive-belt tension, technician a checks for proper pulley alignment. technician b looks up the specified belt t
    9·1 answer
  • When trying to solve a frame problem it will typically be necessary to draw many free body diagrams. a)-True b)-False
    6·1 answer
  • Homes may be heated by pumping hot water through radiators. What mass of water (in g) will provide the same amount of heat when
    8·1 answer
  • Why it is important to prepare first the materials and tools carpentry before doing the tasks?​
    6·2 answers
  • U 4. Find 2 bridges in the US and answer the following:
    15·1 answer
  • Refer to Figure 9-18. A #_____ electrode lead and workpiece lead should be used to carry 150 amperes of electricity 75 feet to t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!