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
Write a function that takes a list as a parameter, converts every element in the list to integar and then returns a tuple compri
abruzzese [7]

Answer:

Following is given the solution of your question as required.

All the necessary descriptions are given in form of comments,

Sample output are also shown.

I hope it will help you!

Explanation:

6 0
3 years ago
Mesh networks:__________.
postnew [5]

Answer:

b. typically contain more circuits in the network than in star or ring networks

Explanation:

In mesh architecture, all computers are connected to each other. In mesh all nodes connect directly and non hierarchical to each other so as  to efficiently route data.

Mesh combines the benefits of both ring and star networks. It  usually provide relatively short routes through the network (compared to ring networks) and provide  many possible routes through the network to prevent one circuit from becoming overloaded (as compared to star network).  Mesh network uses decentralized routing with each network performing its own routing.

Mesh network typically contain more circuits in the network than in star or ring networks and are more expensive than ring networks

7 0
3 years ago
The value 5 is stored in a signed (2's complement) integer. The bits are shifted 4 places to the right. What is the resultant va
anastassius [24]

Answer:

The resultant value is 0

Explanation:

Solution

Given that:

Now

The +5 representation in signed 2's complement integer: 00000101

Thus

When we right shift then, 4 rightmost bit (0101) will be dropped.

The number after 4-bit right shift: 00000000

Therefore the resultant value after 4-bit right shift is "0" in decimal.

6 0
3 years ago
Rickie gets a message from the school’s tech support department. Their computer is supposed to be running the latest system soft
raketka [301]

Answer:

the operating system or web browser

6 0
3 years ago
Read 2 more answers
Using the diagram to the right, match each letter
alexira [117]

Answer:

A - slide

B - ribbon

C- command

D - group

E - format painter

F - tab

Explanation:

edge2020

5 0
3 years ago
Other questions:
  • How do I download the Microsoft word on my Hp probook
    8·2 answers
  • If you want to copy text formatting from one area of your document to another area, _____.
    5·2 answers
  • Translate I don't sing into Spanish​
    11·2 answers
  • Which amendment to the Constitution ended slavery in the United States?
    8·1 answer
  • Write the following program in C++ to print:
    15·1 answer
  • Which of the following is input devices? (a)Scanner (b) Keyboard (c) Both a and b (d) Plotter​
    5·1 answer
  • Python - Write a program to print the multiplication table as shown in the image by using for loops.
    12·1 answer
  • Whats 12/29 divided by 12/34
    7·2 answers
  • Im trying to do an animation only using simplegui in python and my objective is make the ball enters frame, be confused and jump
    12·1 answer
  • What is considered any computer system that isn't a general-purpose pc or server?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!