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
In the 5 Code of Federal Regulations (C.F.R.), it is recommended that an individual has security awareness training before s/he
GarryVolchara [31]

Answer: A it is true.

Explanation: It is true under Subpart C—Information Security Responsibilities for Employees who Manage or Use Federal Information Systems

Number 3 and 4

(3) Program and functional managers must receive training in information security basics; management and implementation level training in security planning and system/application security management; and management and implementation level training in system/application life cycle management, risk management, and contingency planning.

(4) Chief Information Officers (CIOs), IT security program managers, auditors, and other security-oriented personnel (e.g., system and network administrators, and system/application security officers) must receive training in information security basics and broad training in security planning, system and application security management, system/application life cycle management, risk management, and contingency planning.

6 0
3 years ago
Read 2 more answers
If the 1550-lb boom AB, the 190-lb cage BCD, and the 169-lb man have centers of gravity located at points G1, G2 and G3, respect
Natasha2012 [34]

Answer:

hello the required diagram is missing attached to the answer is the required diagram

7.9954 kip.ft

Explanation:

AB = 1550-Ib ( weight acting on AB )

BCD = 190 - Ib ( weight of cage )

169-Ib = weight of man inside cage

Attached is the free hand diagram of the question

calculate distance x!

= cos 75⁰ = \frac{x^!}{10ft}

    x! = 10 * cos 75^{o} = 2.59 ft

calculate distance x

= cos 75⁰ = \frac{x}{30ft}

x = 30 * cos 75⁰ = 7.765 ft

The resultant moment  produced by all the weights about point A

∑ Ma = 0

Ma = 1550 * x! + 190 ( x + 2.5 ) + 169 ( x + 2.5 + 1.75 )

Ma = 1550 * 2.59 + 190 ( 7.765 + 2.5 ) + 169 ( 7.765 + 2.5 + 1.75 )

      = 4014.5 + 1950.35 + 2030.535

      = 7995.385 ft. Ib ≈ 7.9954 kip.ft

6 0
3 years ago
Explain why change is inevitable in complex systems and give examples (apart from prototyping and incremental delivery) of softw
Over [174]

Explanation:

The change in complex systems can be explained according to the relationship of the environment where the system is implemented.

The system environment is dynamic, which consequently leads to adaptation to the system, which generates new requirements inherent to changes in business objectives and policies. Therefore, changing systems is necessary for tuning and usefulness so that the system correctly supports business requirements.

An example is the registration of the justification of the requirements, which is a process activity that supports changes in the system so that the reason for including a requirement is understood, which helps in future changes.

8 0
2 years ago
Would you ever date a transgender person??
nekit [7.7K]

Answer:

well my bff is trans so yes I guess xd

4 0
2 years ago
Read 2 more answers
If you are convicted of D.U.I. a second time in five years, your license may be revoked for up to __________ year/s.
LuckyWell [14K]
If you are convicted of a dui for a second time in five years, your license may be revoked for up to (2) years
5 0
3 years ago
Other questions:
  • Why is a building considered a type of system?
    6·1 answer
  • Harmony in music is characterized by _____.
    14·2 answers
  • 11. Technician A says that gasoline storage containers should be painted red. Technician B says that any metal container may be
    7·1 answer
  • The grade is a measure of quality and it captures concentration levels (i.e., how pure a certain fraction is). If grade captures
    13·1 answer
  • A 1200-kg car moving at 20 km/h is accelerated
    5·1 answer
  • Please help i will give brainilest
    12·2 answers
  • If a tapered roller bearing is adjusted to loose, the bearing will bind and overheat.
    11·1 answer
  • 4. Long term marijuana use can cause
    12·2 answers
  • 3. What is special about beryllium-copper alloy tools?
    6·2 answers
  • Can someone help me LA project pls :((
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!