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
g Consider a thin opaque, horizontal plate with an electrical heater on its backside. The front end is exposed to ambient air th
xxTIMURxx [149]

Answer:

The electrical power is 96.5 W/m^2

Explanation:

The energy balance is:

Ein-Eout=0

qe+\alpha sGs+\alpha skyGsky-EEb(Ts)-qc=0

if:

Gsky=oTsky^4

Eb=oTs^4

qc=h(Ts-Tα)

\alpha s=\frac{\int\limits^\alpha _0 {\alpha l Gl} \, dl }{\int\limits^\alpha _0 {Gl} \, dl }

\alpha s=\frac{\int\limits^\alpha _0 {\alpha lEl(l,5800 } \, dl }{\int\limits^\alpha _0 {El(l,5800)} \, dl }

if Gl≈El(l,5800)

\alpha s=(1-0.2)F(0-2)+(1-0.7)(1-F(0-2))

lt= 2*5800=11600 um-K, at this value, F=0.941

\alpha s=(0.8*0.941)+0.3(1-0.941)=0.77

The hemispherical emissivity is equal to:

E=(1-0.2)F(0-2)+(1-0.7)(1-F(0-2))

lt=2*333=666 K, at this value, F=0

E=0+(1-0.7)(1)=0.3

The hemispherical absorptivity is equal to:

qe=EoTs^{4}+h(Ts-T\alpha  )-\alpha sGs-\alpha oTsky^{4}=(0.3*5.67x10^{-8}*333^{4})+10(60-20)-(0.77-600)-(0.3*5.67x10^{-8}*233^{4})=96.5 W/m^{2}

3 0
3 years ago
What does it mean to say that PEER is a data-driven, consumer-centric, and comprehensive system?
Reika [66]

Answer:

have you heard of gnoogle?

Explanation:have you heard of goongle?

3 0
3 years ago
Read 2 more answers
Can a 1½ " conduit, with a total area of 2.04 square inches, be filled with wires that total 0.93 square inches if the maximum f
Papessa [141]

Answer:

it is not possible to place the wires in the condui

Explanation:

given data

total area = 2.04 square inches

wires total area = 0.93 square inches

maximum fill conduit =  40%

to find out

Can it is possible place wire in conduit conduit

solution

we know maximum fill is 40%

so here first we get total area of conduit that will be

total area of conduit = 40% × 2.04

total area of conduit = 0.816 square inches

but this area is less than required area of wire that is 0.93 square inches

so we can say it is not possible to place the wires in the conduit

4 0
3 years ago
A large particle composite consisting of tungsten particles within a copper matrix is to be prepared. If the volume fractions of
OverLord2011 [107]

Answer:

Upper bounds 22.07 GPa

Lower bounds 17.59 GPa

Explanation:

Calculation to estimate the upper and lower bounds of the modulus of this composite.

First step is to calculate the maximum modulus for the combined material using this formula

Modulus of Elasticity for mixture

E= EcuVcu+EwVw

Let pug in the formula

E =( 110 x 0.40)+ (407 x 0.60)

E=44+244.2 GPa

E=288.2GPa

Second step is to calculate the combined specific gravity using this formula

p= pcuVcu+pwTw

Let plug in the formula

p = (19.3 x 0.40) + (8.9 x 0.60)

p=7.72+5.34

p=13.06

Now let calculate the UPPER BOUNDS and the LOWER BOUNDS of the Specific stiffness

UPPER BOUNDS

Using this formula

Upper bounds=E/p

Let plug in the formula

Upper bounds=288.2/13.06

Upper bounds=22.07 GPa

LOWER BOUNDS

Using this formula

Lower bounds=EcuVcu/pcu+EwVw/pw

Let plug in the formula

Lower bounds =( 110 x 0.40)/8.9+ (407 x 0.60)/19.3

Lower bounds=(44/8.9)+(244.2/19.3)

Lower bounds=4.94+12.65

Lower bounds=17.59 GPa

Therefore the Estimated upper and lower bounds of the modulus of this composite will be:

Upper bounds 22.07 GPa

Lower bounds 17.59 GPa

7 0
3 years ago
A reciprocating compressor takes a compresses it to 5 bar. Assuming that the compression is reversible and has an index, k, of 1
Gelneren [198K]

Answer:

final temperature is 424.8 K

so correct option is e 424.8 K

Explanation:

given data

pressure p1 = 1 bar

pressure p2 = 5 bar

index k = 1.3

temperature t1 = 20°C = 293 k

to find out

final temperature  t2

solution

we have given compression is reversible and has an index k

so we can say temperature is

\frac{t2}{t1}= [\frac{p2}{p1}]^{\frac{k-1}{k} }  ...........1

put here all these value and we get t2

\frac{t2}{293}= [\frac{5}{1}]^{\frac{1.3-1}{1.3} }

t2 = 424.8

final temperature is 424.8 K

so correct option is e

5 0
3 years ago
Other questions:
  • A milling operation was used to remove a portion of a solid bar of square cross section. Forces of magnitude P = 18 kN are appli
    15·1 answer
  • What are the four processes of the Carnot cycle? Sketch the Carnot cycle (a) on T-s (temperature - entropy) and P-V (pressure -
    7·1 answer
  • A part has been tested to have Sut = 530 MPa, f = 0.9, and a fully corrected Se = 210 MPa. The design requirements call for the
    10·1 answer
  • A Carnot engine has a piston displacement volume of 7.5 liters. The volume at the beginning of heat addition is 1.0 liters, the
    14·1 answer
  • Significant figures are an indicator of accuracy. a) True b) False
    8·1 answer
  • What are common names assigned to instruction addresses in a PLC program called
    8·1 answer
  • Why is there an Engineering Process?
    15·2 answers
  • What is the name of the type of rocker arm stud that does not require a valve adjustment?
    12·1 answer
  • The main function of a router is to
    14·2 answers
  • If a bearing needs 4. 0 s to solidify enough for impact, how high must the tower be?.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!