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
Akimi4 [234]
4 years ago
15

Write a c ++ program that reads unknown number of integers from the user and stores them into a vector. The user will indicate t

he end of numbers by entering a 0. The program should then print out these numbers in reverse order.
Computers and Technology
1 answer:
SVETLANKA909090 [29]4 years ago
4 0

Answer:

#include <iostream>

#include <vector>

using namespace std;

int main() {

vector<int> numberlist;

int number;

while (1) {

 cout << "Enter a number: ";

 cin >> number;

 if (number == 0) break;

 numberlist.push_back(number);

};

reverse(numberlist.begin(), numberlist.end());

for (int number : numberlist) {

 cout << number << " ";

}

return 0;

}

Explanation:

There is a built-in function to reverse the contents of a vector.

You might be interested in
You also learn in class that one kilobyte of computer memory will hold about 2/3 of a page of typical text (without formatting).
Travka [436]

Answer:

The flashdrive can hold 35389 400-pages-books

Explanation:

If \frac{2}{3} of a page occupies 1 kB of memory, we can calculate how much memory a book will take

2/3kB=1 page\\ x kB=400 pages\\266.67 kB=400 pages

Now that we know that a book average file size is about 266,67 kB, we calculate how many of them can a 9 GB flash drive hold.

To do the calculation, we have to know how many kilobytes are in 9 gigabytes.

There is 1024 kilobytes in a megabyte, and 1024 megabytes in a gigabyte, so:

Memory_{in _kilobytes}^{} =1024\frac{kilobytes}{megabytes} *1024\frac{megabytes}{gigabytes}*9=9437184 kilobytes

Finally, knowing the average file size of a book and how much memory in kilobytes the 9 GB flash drive holds, we calculate how many books can it hold.

Books=\frac{Flash drive memory}{Filesize of a book} =\frac{9437184kilobytes}{266.67\frac{kilobytes}{book} } =35389,4 books

The flashdrive can hold 35389 400-pages-books, or 14155776 pages of typical text.

8 0
4 years ago
Why are some studs and bolts undercut in the middle?
Sholpan [36]
Undercut studs have a shank equal to the pitch diameter of the screw thread.
6 0
3 years ago
What is the name of a button on a website?
zhuklara [117]
May I know which button?
5 0
3 years ago
You are a domain administrator for a large, multi-domain network. There are approximately 2500 computers in your domain. Organiz
Anit [1.1K]

Answer:

move the computer accounts from their current location to the correct Organizational Units (OU's)

Explanation:

Based on the information provided within the question it can be said that in this scenario the best thing to do would be to move the computer accounts from their current location to the correct Organizational Units (OU's). This would keep things organized and have each computer account in the unit that they belong with the correct access and privileges that they need.

5 0
4 years ago
Generally speaking, what is a “best practice"?
miss Akunina [59]

Answer:

What’s up, I’m currently in this class, and I was wondering if it’s easy or hard?

Explanation:

3 0
3 years ago
Other questions:
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    5·1 answer
  • 5. If you are 16 to 20 years old, you are __________.
    14·1 answer
  • Using the drop-down menus, correctly complete the sentences.
    5·2 answers
  • A website updated daily could be considered _____. a. authoritative b. objective c. accurate d. timely
    8·1 answer
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • Considering current online newspaper editions and the characteristics of digital age media, how do you think newspaper design mi
    7·1 answer
  • Consider the problem of making change for n cents using the fewest number of coins. Assume that each coins value is an integer.
    7·1 answer
  • I love this an this a a good app ❤️❤️❤️​
    5·2 answers
  • How we can load program on the browser window.​
    7·2 answers
  • Read the following statements and select the
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!