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
elixir [45]
3 years ago
5

Write a C++ console program to do the following: 1. Define an array of ints with the ten elements { 0, 1,2,3, 4, 5, 6, 7, 8, 9 }

. 2. Define a vector with those ten elements. 3. Define a list with those ten elements. 4. Define a second array, vect
Computers and Technology
1 answer:
Gemiola [76]3 years ago
7 0

Answer:

#include<iostream>

#include <vector>

#include <list>

using namespace std;

int main(){

int a[10]={0,1,2,3, 4, 5, 6, 7, 8, 9 };

std::vector<int> v (&a[0],&a[0]+10);

std::list<int> l (&a[0],&a[0]+10);

int b[10];

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

b[i]=a[i];

}

std::vector<int> v2(v);

std::list<int> l2(l);

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

b[i]+=2;

}

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

v2[i]+=3;

}

for (std::list<int>::iterator it = l2.begin(); it != l2.end(); it++)

*it=*it+5;

cout<<"Each containers value are: "<<endl;

cout<<"1st array: "<<endl;

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

cout<<a[i]<<" ";

}

cout<<"\n 1st vector: \n";

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

cout<<v[i]<<" ";

}

cout<<"\n 1st List is:\n";

for (std::list<int>::iterator it = l.begin(); it != l.end(); it++)

cout << *it << ' ';

cout<<"\n 2nd array: "<<endl;

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

cout<<b[i]<<" ";

}

cout<<"\n 2nd vector:\n";

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

cout<<v2[i]<<" ";

}

cout<<"\n 2nd list:\n";

for (std::list<int>::iterator it = l2.begin(); it != l2.end(); it++)

cout << *it << ' ';  

return 0;

}

Explanation:

  • Initialize an array, a vector and a list of type integer .
  • Create a 2nd array, vector, and list as a copy of the first array, vector, and list.
  • Increase the value of each element in the array by 2 , vector by 3 and list by 5.
  • Finally display the relevant results.
You might be interested in
When backing up a database server to LTO tape drives, the following schedule is used. Backups take one hour to complete.
AleksandrR [38]

Answer:

C. 3

Explanation:

Linear Tape Open LTO tape drives are magnetic tapes used to store data. This can be used with small and large computers for backup purposes. The backup needs to maintained frequently so that new data is backup on every interval. The is a RAID failure on database server to ensure complete backup there must be 3  backup tapes needed.

4 0
3 years ago
Which category does this fall in identity theft​
g100num [7]

Answer:

A crime.

Explanation:

It's illegal.

8 0
3 years ago
In the computing environment the numerical value represented by the pre-fixes kilo-, mega-, giga-, and so on can vary depending
nignag [31]

Answer:

1024 bytes in a megabyte and there are 8000000 bits in a megabyte. They are different.

Explanation:

5 0
3 years ago
Referat noaptea la școala cu sfârșit de groază​
solniwko [45]

Te ajut eu daca vrei tu la refera

7 0
3 years ago
Which of the following is a Microsoft solution
Sholpan [36]

Answer:

TS RemoteApp

Explanation:

The question is wrong. Correct question and choices are:

Which of the following is a Microsoft solution that runs on a Microsoft Terminal Services server but appears, to end users, as if it were actually running on their systems?

a.TS Web Access

b.DirectAccess

c.TS RemoteApp

d.Terminal Services for Applications

Terminal Services RemoteApp can be used remotely via remote desktop protocal (RDP) but look like to users as if they are running locally by successfully integrating user's desktop.

These applications are available since Windows Server 2008 and can be used on various windows operating systems.

7 0
3 years ago
Other questions:
  • At the end of your presentation, the main points should be a. Summarized c. Handed to your teacher b. Written on the board d. Re
    7·2 answers
  • Unlike the String class where you must pass a message to an object (instance) of the class, as in x.length( ), in order to use t
    5·1 answer
  • You would like to know how many cells contain data. Which function should you use?
    11·1 answer
  • Whay device is recommended to use to install windows 10
    13·1 answer
  • Marie uses DHTML to create a website for her college. How is DHTML more helpful than HTML?
    13·2 answers
  • The IT Department already has been testing Windows Server 2012 R2, and some time ago purchased licenses to convert all of its Wi
    14·1 answer
  • In this lab, you will use all of the graphics commands you have learned to create an animated scene. Your program should have a
    10·1 answer
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    12·1 answer
  • Cryptocurrencies are digital tokens that are created independently of government money, and can act as a medium of exchange and
    15·1 answer
  • A penetration tester is experimenting with Network Mapper (Nmap) on a test network as a privileged user. The tester would like t
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!