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
Whats viruses c liver?
PtichkaEL [24]

Answer:

Hepatitis C is a viral infection that causes liver inflammation, sometimes leading to serious liver damage. The hepatitis C virus (HCV) spreads through contaminated blood.

5 0
2 years ago
Read 2 more answers
(35-39) A student travels on a school bus in the middle of winter from home to school. The school bus temperature is 68.0° F. Th
arlik [135]

Answer:

The net energy transfer from the student's body during the 20-min ride to school is 139.164 BTU.

Explanation:

From Heat Transfer we determine that heat transfer rate due to electromagnetic radiation (\dot Q), measured in BTU per hour, is represented by this formula:

\dot Q = \epsilon\cdot A\cdot \sigma \cdot (T_{s}^{4}-T_{b}^{4}) (1)

Where:

\epsilon - Emissivity, dimensionless.

A - Surface area of the student, measured in square feet.

\sigma - Stefan-Boltzmann constant, measured in BTU per hour-square feet-quartic Rankine.

T_{s} - Temperature of the student, measured in Rankine.

T_{b} - Temperature of the bus, measured in Rankine.

If we know that \epsilon = 0.90, A = 16.188\,ft^{2}, \sigma = 1.714\times 10^{-9}\,\frac{BTU}{h\cdot ft^{2}\cdot R^{4}}, T_{s} = 554.07\,R and T_{b} = 527.67\,R, then the heat transfer rate due to electromagnetic radiation is:

\dot Q = (0.90)\cdot (16.188\,ft^{2})\cdot \left(1.714\times 10^{-9}\,\frac{BTU}{h\cdot ft^{2}\cdot R^{4}} \right)\cdot [(554.07\,R)^{4}-(527.67\,R)^{4}]

\dot Q = 417.492\,\frac{BTU}{h}

Under the consideration of steady heat transfer we find that the net energy transfer from the student's body during the 20 min-ride to school is:

Q = \dot Q \cdot \Delta t (2)

Where \Delta t is the heat transfer time, measured in hours.

If we know that \dot Q = 417.492\,\frac{BTU}{h} and \Delta t = \frac{1}{3}\,h, then the net energy transfer is:

Q = \left(417.492\,\frac{BTU}{h} \right)\cdot \left(\frac{1}{3}\,h \right)

Q = 139.164\,BTU

The net energy transfer from the student's body during the 20-min ride to school is 139.164 BTU.

7 0
2 years ago
A negative pressure respirator brings fresh air to you through a hose<br>A) True<br>B)False​
madreJ [45]

Answer:FALSE

Explanation: A negative pressure respirator is a respiratory system which is known to have a low air pressure inside the mask when compared to the air pressure on the outside during Inhalation.

Most of the personal protective equipment (PPE) which are in use in various industries are examples of Negative pressure respirator device,any leak or damage done to the device will allow the inflows of harmful and toxic Air into the person's respiratory system. AIR SUPPLY SYSTEMS ARE KNOWN TO SUPPLY FRESH UNCONTAMINATED AIR THROUGH AIR STORED INSIDE COMPRESSED CYLINDERS OR OTHER SOURCES AVAILABLE.

8 0
3 years ago
Read 2 more answers
C++A palindrome is a string such as "madam", "radar", "Dad", and "I", that reads the same forwards and backwards. The empty stri
jeka57 [31]

Answer:

See explaination

Explanation:

#include <iostream>

#include<string.h>

using namespace std;

bool isPalindrome(string str, int lower, int upper){

if(str.length() == 0 || lower>=upper){

return true;

}

else{

if(str.at(lower) == str.at(upper)){

return isPalindrome(str,lower+1,upper-1);

}

else{

return false;

}

}

}

int main(){

string input;

cout<<"Enter string: ";

cin>>input;

if(isPalindrome(input,0,input.length()-1)){

cout<<input<<" is a palindrome"<<endl;

}

else{

cout<<input<<" is NOT a palindrome"<<endl;

}

return 0;

}

5 0
2 years ago
Steam at a pressure of 100 bar and temperature of 600 °C enters an adiabatic nozzle with a velocity of 35 m/s. It leaves the noz
butalik [34]

Answer:

Exit velocity V_2=1472.2 m/s.

Explanation:

Given:

At inlet:

P_1=100 bar,T_=600°C,V_1=35m/s

Properties of steam at 100 bar and 600°C

        h_1=3624.7\frac{KJ}{Kg}

At exit:Lets take exit velocity V_2

We know that if we know only one property inside the dome  then we will find the other property by using steam property table.

Given that dryness or quality of steam at the exit of nozzle  is 0.85 and pressure P=80 bar.So from steam table we can find the other properties.

Properties of saturated steam at 80 bar

   h_f= 1316.61\frac{KJ}{Kg} ,h_g= 2757.8\frac{KJ}{Kg}

So the enthalpy of steam at the exit of turbine  

h_2=h_f+x(h_g-h_f)\frac{KJ}{Kg}

h_2=1316.61+0.85(2757.8-1316.61)\frac{KJ}{Kg}

 h_2=2541.62\frac{KJ}{Kg}

Now from first law for open system

h_1+\dfrac{V_1^2}{2}+Q=h_2+\dfrac{V_2^2}{2}+w

In the case of adiabatic nozzle Q=0,W=0

3624.7+\dfrac{35^2}{2000}+0=2541.62+\dfrac{(V_2)^2}{2000}+0

V_2=1472.2 m/s

So Exit velocity V_2=1472.2 m/s.

4 0
3 years ago
Other questions:
  • Members of the student council have been asked by their
    5·1 answer
  • Explain why you chose the final design of your prototype and how it solved the identified need
    9·1 answer
  • 3Px=y−y2p2<br><br>first order higher dgree​
    11·1 answer
  • 1. You are asked to write a report about one of the structures that Transportation Engineers
    9·1 answer
  • 1. In order for a team to accomplish its goal(s), it is NOT important for the team members to
    14·2 answers
  • For somebody
    12·1 answer
  • Close to 16 billion pounds of ethylene glycol (EG) were produced in 2013. It previously ranked as the twenty-sixth most produced
    8·1 answer
  • Engineered lumber should not be used for
    15·1 answer
  • Ignition for heavy fuel oil?
    12·2 answers
  • A plant has ten machines and currently operates two 8-hr shift per day, 5 days per week, 50 weeks per year. the ten machines pro
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!