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
Silicon chips are used primarily in ?
VMariaS [17]

Answer:

4th generation computers

5 0
2 years ago
3. If nothing can ever be at absolute zero, why does the concept exist?
Tanzania [10]

The absolute zero in temperature refers to the minimal possible temperature. It is the temperature at which the molecules of a system stop moving, so it is a really useful reference point.

<h3>Why absolute zero can't be reached?</h3>

It would mean that we need to remove all the energy from a system, but to do this we need to interact with the system in some way, and by interacting with it we give it "some" energy.

Actually, from a quantum mechanical point of view, the absolute zero has a residual energy (so it is not actually zero) and it is called the "zero point". This happens because it must meet <u>Heisenberg's uncertainty principle</u>.

So yes, the absolute zero can't be reached, but there are really good approximations (At the moment there is a difference of about 150 nanokelvins between the absolute zero and the smallest temperature reached). Also, there are a lot of investigations near the absolute zero, like people that try to reach it or people that just need to work with really low temperatures, like in type I superconductors.

So, concluding, why does the concept exist?

  • Because it is a reference point.
  • It is the theoretical temperature at which the molecules stop moving, defining this as the <u>minimum possible temperature.</u>

If you want to learn more about the absolute zero, you can read:

brainly.com/question/3795971

3 0
2 years ago
Which band has an average of $3.58 per hour of parking?
Minchanka [31]
C it would be c because that has more and the others have less
6 0
2 years ago
What is differentiation​
oksian1 [2.3K]

Answer:

the action or process of differentiating or distinguishing between two or more things or people.

7 0
3 years ago
Interpret the assembly program below: MOV R3,R0;
Reika [66]

Answer:

Explanation:

1.  With the operands R0, R1, the program would compute AND operation and ADD operation .

2. The operands could truly be signed 2's complement encoded (i.e Yes) .

3. The overflow truly occurs when two numbers that are unsigned were added and the result is larger than the capacity of the register, in that situation, overflow would occur and it could corrupt the data.

 When the result of an operation is smaller in magnitude than the smallest value represented by the data type, then arithmetic underflow will occur.

7 0
3 years ago
Other questions:
  • Policy makers in the U.S. government have long tried to write laws that encourage growth in per capita real GDP. These laws typi
    6·1 answer
  • . A roadway is being designed capable of allowing 70 mph vehicle speed. The superelevation around one curve is 0.05 inches per i
    15·1 answer
  • A model of a submarine, 1:15 scale, is to be tested at 180 ft/s in a wind tunnel with standard sea-level air, while theprototype
    8·1 answer
  • A hydraulic cylinder has a 125-mm diameter piston with hydraulic fluid inside the cylinder and an ambient pressure of 1 bar. Ass
    8·1 answer
  • The minimum fresh air requirement of a residential building is specified to be 0.35 air changes per hour (ASHRAE, Standard 62, 1
    10·1 answer
  • When a user process is interrupted or causes a processor exception, the x86 hardware switches the stack pointer to a kernel stac
    13·1 answer
  • For Laminar flow conditions, what size pipe will deliver 90 gpm of medium oil at 40°F (υ = 6.55 * 10^‐5)?
    12·1 answer
  • ____________ is the organization that oversees environmental compliance.
    14·1 answer
  • Why does my delivery date keep changing on my tesla model 3
    13·1 answer
  • Describe two other safe driver skills a driver should use when driving in this road condition
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!