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
A mass weighing 22 lb stretches a spring 4.5 in. The mass is also attached to a damper with Y coefficient . Determine the value
Dominik [7]

Answer:

Cc= 12.7 lb.sec/ft

Explanation:

Given that

m = 22 lb

g= 32 ft/s²

m = \dfrac{22}{32}=0.6875\ s^2/ft

x= 4.5 in

1 in = 0.083 ft

x= 0.375 ft

Spring constant ,K

K=\dfrac{m}{x}=\dfrac{22}{0.375}

K= 58.66  lb/ft

The damper coefficient for critically damped system

C_c=2\sqrt{mK}

C_c=2\sqrt{0.6875\times 58.66}

Cc= 12.7 lb.sec/ft

5 0
3 years ago
The first thing you should do is develop a ____________________ to determine what vehicle you can afford.
swat32

The first thing you should do is develop a <u>budget</u> to determine what vehicle you can afford.

<h3>What is an automobile?</h3>

An automobile is also referred to as a vehicle, car or motorcar and it can be defined as a four-wheeled vehicle that is designed and developed to be propelled by an internal-combustion (gasoline) engine, especially for the purpose of transportation from one location to another.

<h3>What is a budget?</h3>

A budget can be defined as a financial plan that is typically used for the estimation of revenue and expenditures of an individual, business organization or government for a specified period of time, often one year.

In this context, we can reasonably infer and logically deduce that the first thing anyone should do is to develop a <u>budget</u> in order to determine what vehicle they can afford.

Read more on budget here: brainly.com/question/13964173

#SPJ1

7 0
1 year ago
1. Which of the following will cause a spark knock?
zlopas [31]

Answer:

I couldn't find options for your question online, but I can give you an explanation so you can choose the correct option.

Explanation:

A spark knock is a form of unpredictable behavior that occurs in combustion, that is, in the chemical reaction that occurs between oxygen and an oxidizable material. Such combustion is usually manifested by incandescence or flame.

The spark knock is a detonation that occurs when there is a lot of pressure in the fuel.

<u>Some situations in which this can happen are: </u>

  • Engine overloaded.
  • Maximum pressure in the cylinders.
  • Engine overheated.
  • Overheated air.
  • Long and excessive engine ignition timing.
  • Spark plug at high temperatures.
5 0
3 years ago
When would working with machinery be a common type of caught-in and caught-between<br> hazard?
tigry1 [53]

Answer:

A working with machinery be a common type of caught-in and caught-between  hazard is described below in complete detail.

Explanation:

“Caught in-between” accidents kill mechanics in a variety of techniques. These incorporate cave-ins and other hazards of tunneling activity; body parts extracted into unconscious machinery; reaching within the swing range of cranes and other installation material; caught between machine & fixed objects.

6 0
2 years ago
Anne works with other engineers studying physical processes that involve the flow of particles. Which field of engineering would
slega [8]

Answer:

Option A

Chemical engineering

Explanation:

Chemical engineering mainly encompass the study of behavior of different particles such as petroleum, water, drugs and other products. When Anne is involved in a study with engineers who study flow of particles, the flow, viscosity and other properties are among the behavior that chemical engineers are involved in.

3 0
3 years ago
Other questions:
  • The water in a large lake is to be used to generate electricity by the installation of a hydraulic turbine-generator at a locati
    7·1 answer
  • Choose the best data type for each of the following so that any reasonable value is accommodated but no memory storage is wasted
    5·1 answer
  • In case of damaged prestressed concrete I girders which are used for restoring strength?
    9·1 answer
  • The value of the critical Reynolds number for the flow over a flat plate is 5 x10^5. The significance of the value is:
    13·1 answer
  • Opposition to current flow, restricts or resists current flow
    15·1 answer
  • Which of the following is correct oil viscosity for hybrid electric vehicle?
    10·1 answer
  • The speed of an aircraft is given to be 260 m/s in air. If the speed of sound at that location is 330 m/s, the flight of the air
    6·1 answer
  • The two types of outlets that are found in an electrical system are:______
    7·1 answer
  • Which of the following is a Dashboard Scoreboard for alignment of the business where information is constantly flowing through t
    5·1 answer
  • Describe the meaning of the different symbols and abbreviations found on the documents that they use
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!