Question
Asked Nov 18, 2019
1 views

in c++ 

  1. Given the following, use a for loop to load the array with user input (include a prompt cout followed by cin):

    const int SIZE = 5;
    int numbers[SIZE];
check_circle

Expert Answer

Step 1

Program Algorithm-

START

Step1: Import the essential headers

Step2: Define the main function.

Step3: Declare all the variables and their datatypes accordingly.

Step4: Define the array and its size.

Step5: Prompt the user to input the elements in the array.

Step6: Use for loop to input the elements in each iteration.

Step7: Use another for loop to print the elements of the array.

Step8: Display the elements in the array.

END

 

Step 2

Code-

#include <iostream>

using namespace std;

int main()

{

const int SIZE = 5;

int num[SIZE];//defining the array of size 5

cout <<"Enter the elements to be filled in the array: \n";

for (int i = 0; i < SIZE; i++)

{

cin >> num[i];//Taking the input from the user

}...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: help make the truth table for this question.   Given two 2-bit two’s complement numbers A and B, pr...

A: Instructions to follow:Since the numbers A and B are 2-bits two’s compliment numbers, they can be re...

question_answer

Q: Find those job categories whose maximum salary among the people hired after 1980 is more than 2500 F...

A: 1)To find those job categories whose maximum salary among the people hired after 1980 is more than 2...

question_answer

Q: Suppose you want to build a program using WebGL that draws two kinds of objects - shiny billiard bal...

A: Drawing multiple objects in WebGLIn order to draw two kinds of objects in WebGL, first call function...

question_answer

Q: WHAT IS BLOCKCHAIN?

A: DefinitionBlockchain is a novel technology of today’s era. Blockchain is basically a growing list of...

question_answer

Q: Write a program (IN C++) that will present the user with a main menu of options which the user can c...

A: Click to see the answer

question_answer

Q: Given the following business rules, define the relationships between entities and cardinalities:   A...

A: Relationship between entitiesHere entities are university, school, department, professor and course....

question_answer

Q: List and define the factors that are likely to shift in an orginizations information security enviro...

A: Information security and its need:In essence, information security is the application of organizatio...

question_answer

Q: Even though the employees in the Cisco systems have doubled, STs remains the same. Why? And how it h...

A: Cisco systemsCisco systems develop, manufactures and sells networking hardware, telecommunications e...

question_answer

Q: ABC Accounting Company is a company that manages the financials for various small companies on a nat...

A: 1) To prevent remote employees from being hacked, the following steps can be taken:A Virtual private...