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
MatroZZZ [7]
3 years ago
9

Append newValue to the end of vector tempReadings. Ex: If newValue = 67, then tempReadings = {53, 57, 60} becomes {53, 57, 60, 6

7}.
#include
#include
using namespace std;
int main() {
vector tempReadings(3);
int newValue = 0;
unsigned int i = 0;
tempReadings.at(0) = 53;
tempReadings.at(1) = 57;
tempReadings.at(2) = 60;
newValue = 67;
/* Your solution goes here */
for (i = 0; i < tempReadings.size(); ++i) {
cout << tempReadings.at(i) << " ";
}
cout << endl;
return 0;
}
2.Remove the last element from vector ticketList.
#include
#include
using namespace std;
int main() {
vector ticketList(3);
unsigned int i = 0;
ticketList.at(0) = 5;
ticketList.at(1) = 100;
ticketList.at(2) = 12;
/* Your solution goes here */
for (i = 0; i < ticketList.size(); ++i) {
cout << ticketList.at(i) << " ";
}
cout << endl;
return 0;
}
3. Assign the size of vector sensorReadings to currentSize.
#include
#include
using namespace std;
int main() {
vector sensorReadings(4);
int currentSize = 0;
sensorReadings.resize(10);
/* Your solution goes here */
cout << "Number of elements: " << currentSize << endl;
return 0;
}
4. Write a statement to print "Last mpg reading: " followed by the value of mpgTracker's last element. End with newline. Ex: If mpgTracker = {17, 19, 20}, print:
Last mpg reading: 20
#include
#include
using namespace std;
int main() {
vector mpgTracker(3);
mpgTracker.at(0) = 17;
mpgTracker.at(1) = 19;
mpgTracker.at(2) = 20;
/* Your solution goes here */
return 0;}

Computers and Technology
1 answer:
viva [34]3 years ago
3 0

Answer:

Following are the code to this question:

In question 1:

tempReadings.push_back(newValue); //using array that store value in at 3 position

In question 2:

ticketList.pop_back(); //defining ticketList that uses the pop_back method to remove last insert value

In question 3:

currentSize = sensorReadings.size(); /defining currentSize variable holds the sensorReadings size value

In question 4:

cout<<"Last mpg reading: "<<mpgTracker.at(mpgTracker.size()-1)<<endl;

//using mpgTracker array with at method that prints last element value

Explanation:

please find the attachment of the questions output:

  • In the first question, it uses the push_back method, which assigns the value in the third position, that is "53, 57, 60, and 67 "
  • In the second question, It uses the pop_back method, which removes the last element, that is "5 and 100"
  • In the third question, It uses the "currentSize" variable to holds the "sensorReadings" size value, which is "10".
  • In the fourth question, It uses the mpgTracker array with the "at" method, which prints the last element value, which is "20".

You might be interested in
5255555555555+55555555555555/1111*99442
Marina CMI [18]

Answer:

(502763134343429265 /101)

Explanation:

7 0
4 years ago
Read 2 more answers
Assume we are testing a variable is_sunny in a while loop. is_sunny = “n”.
zubka84 [21]

Answer:

while(is_sunny=="n")

Explanation:

The loop keeps repeating itself until a certain condition is met.

Here while loop keeps executing until value of is_sunny is not equal to 'n'

When the value of is_sunny is not equal to n then the loop stops.

So lets explain this logic with a chunk of code:

#include <iostream> //to use input output functions

using namespace std; //to identify objects like cin cout

int main() {  //start of main function

  string is_sunny = "n"; //value of is_sunny is set to n

  cout<<"Enter value of is_sunny: "; // prompts user to enter value of is_sunny

  cin>>is_sunny; // reads value of is_sunny from user

  while(is_sunny=="n") // keeps iterating until value of is_sunny is not equal to n

  {   cout<<"keep executing until is_sunny is not equal to n"<<endl;//display this message with each iteration

      cout<<"Enter value of is_sunny: "; //keeps prompting to enter is_sunny

      cin>>is_sunny;   } } //keeps reading value of is_sunny from user

Now if the user keeps entering "n" as value of is_sunny then the loop keeps repeating. When the user enters any string other than n then the loop breaks. The output of the program is attached.

6 0
3 years ago
What Is one reason that more personal computers have windows operating systems as opposed to Mac operating systems
erma4kov [3.2K]

if you search up how windows is better that mac this comes up

"99% of these users will prefer a PC to a Mac because it's the right platform for their needs. Final Cut Pro users use Macs. It doesn't run on Windows.... ... Extreme enthusiasts prefer PCs because they can run better hardware in a PC than they can get in a Mac."

all you have to do is put it in your own words :)

8 0
3 years ago
Read 2 more answers
An application that can be launched from my web browser is known as a _____. java applet spreadsheet cad software music applicat
SIZIF [17.4K]
An application that can be launched from my web browser is known as a java applet. Java applet is a <span>small application which users can launch from a web-page, that clearly coincides with the statement in the task. As you can see, java is the most appropriate word for the gap.
Regards.</span>
4 0
3 years ago
A(n) _____ is a network confined to sites on internal web servers and only available to individuals within an organization.
Mariulka [41]
A closed network<span> is a network confined to sites on internal web servers and only available to individuals within an organization.</span>
6 0
3 years ago
Other questions:
  • What is the role of the ieee in computer networking and wireless communications?
    14·1 answer
  • B. Write a function that takes one double parameter, and returns a char. The parameter represents a grade, and the char represen
    7·1 answer
  • You have implemented a network where each device provides shraed files with all other devices on the network. what type of netwo
    10·1 answer
  • The growing network of physical objects that will have sensors connected to the Internet is referred to as the ________.
    13·1 answer
  • Does anyone know to get Google updated if it failed to update?
    12·1 answer
  • Write a c++ application that computes gross salary for Mr.A,given that during the interview session and before started work, it
    5·1 answer
  • 3.4.6 colorful bracelet ?
    5·1 answer
  • Tax preparation software can help prepare and file your taxes by _________.
    7·1 answer
  • A. Modify the FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating,
    12·1 answer
  • What are the methods of gilding<br><br>nonsense will be immediately reported. ​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!