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
kaheart [24]
3 years ago
6

5.18 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those integers in reverse. The in

put begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a comma, including the last one. Ex: If the input is: 5 2 4 6 8 10 the output is: 10,8,6,4,2, To achieve the above, first read the integers into a vector. Then output the vector in reverse.
Computers and Technology
1 answer:
Rina8888 [55]3 years ago
6 0

Answer:

In C++:

#include<iostream>

#include<vector>

using namespace std;

int main(){

   int len, num;

   vector<int> vect;

   cout<<"Length: ";

   cin>>len;  

   for(int i = 0; i<len;i++){

       cin>>num;

   vect.push_back(num);}

   vector<int>::iterator iter;

   for (iter = vect.end() - 1; iter >= vect.begin(); iter--){

       cout << *iter << ", ";}    

}

Explanation:

This declares the length of vector and input number as integer

   int len, num;

This declares an integer vector

   vector<int> vect;

This prompts the user for length  

cout<<"Length: ";

This gets the input for length  

   cin>>len;  

The following iteration gets input into the vector

<em>    for(int i = 0; i<len;i++){</em>

<em>        cin>>num;</em>

<em>    vect.push_back(num);}</em>

This declares an iterator for the vector

   vector<int>::iterator iter;

The following iterates from the end to the beginning and prints the vector in reverse

<em>    for (iter = vect.end() - 1; iter >= vect.begin(); iter--){</em>

<em>        cout << *iter << ", ";}</em>

<em />

<em />

You might be interested in
HELP PLEASE!!!! If you are continually building, reviewing, correcting a model of your system, and incrementally adding to the s
Novosadov [1.4K]

Answer: evolutionary with high fidelity

Explanation:

You are trying to improve the model so that it is able to match any problem. This is evolutionary.

At the same time the model seems to be close to being finalised with all the improvements being made. It is past the design stage and so must be a high fidelity prototype.

6 0
3 years ago
When typing in a spreadsheet cell, hitting the Tab key will bring which result?
xxTIMURxx [149]
It’s B. Move to the next cell to the right.
6 0
3 years ago
When can designers use rapid application development? HELP ASAP
Bess [88]

I pretty sure you it’s the third one c.

6 0
3 years ago
Briefly describe three (3) obstacles to becoming
Bingel [31]

Obstacles to becoming digital literates and solutions include:

1. Poor network connectivity. Solutions are:

  • Use good network service providers.
  • Find a good location with good internet facilities.

2. Authenticating Information. Solutions are:

  • Ensure you do a thorough research before sharing any information on the internet.
  • Learn to be critical with information.

3. Excessive Use of the Internet. Solutions are:

  • Always have a target of what you want to achieve with the internet.
  • Avoid unproductive activities.

<h3>What is Digital Literacy?</h3>

Digital literacy can be defined as the ability or skills needed to be able to access information and communicate via internet platforms, mobile devices, or social media.

<h3>Obstacles to becoming Digital Literates</h3>

1. <u>Poor Network Connectivity</u>: In areas where network connectivity is poor, digital literacy becomes difficult to achieve as accessing the internet to source information would be impeded. The solutions to this are:

  • Use good network service providers.
  • Find a good location with good internet facilities.

2. <u>Authenticating Information:</u> The internet is awash with information, most of which may not be verifiable, when a user becomes misinformed, they tend to have biases which affects their critical thinking. Solutions to this are:

  • Ensure you do a thorough research before sharing any information on the internet.
  • Learn to be critical with information.

3. <u>Excessive Use of the Internet:</u> People tend to spend much time on the internet which at the end of the day becomes unproductive. Solutions to this include:

  • Always have a target of what you want to achieve with the internet.
  • Avoid unproductive activities.

Learn more about digital literacy on:

brainly.com/question/14242512

6 0
3 years ago
How is hyper tension, heart disease, and strokes related?
amid [387]
Hypertension, heart disease, and stroke are related by the process of atherosclerosis. Atherosclerosis refers to the build-up and accumulation of fatty substances (also known as plaque) in the inner walls of the arteries. Atherosclerosis can lead to hypertension, heart disease, and strokes.
5 0
3 years ago
Other questions:
  • What is a drawback to being in Slide Show mode? a- Being able to review each slide in order
    8·2 answers
  • Adding functionality to a Button is easy when you use the IDE. After you have dragged a Button onto a Form, you can ____ it to c
    7·1 answer
  • A technician is using a network-attached desktop computer with a Type 2 hypervisor to run two VMs. One of the VMs is infected wi
    14·1 answer
  • The ___________________ command is used to establish connectivity.
    14·1 answer
  • solve this simple question 1) Let S = {a, bb, bab, abaab} be a set of strings. Are abbabaabab and baabbbabbaabb in S*? Does any
    8·1 answer
  • What do you understand by technological depenence?
    9·1 answer
  • True/False/Unknown. For the interpretation of function calls, we assign the formal parametersto the valuations of the actual arg
    11·1 answer
  • A filter is a camera accessory that is mounted on the optical path of the lens.<br> true or false
    6·2 answers
  • Explanation historical development of computer ​
    10·1 answer
  • Which of the following shows the assignment of a string to a variable? Select 3 options.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!