Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
// CPSC 121L-14
// 04.11.2024
// @Apromodo
// [email protected]
//
// Lab 10-1
#include <iostream>
#include <map>
#include <vector>
#include "plane.h"
int main() {
std::vector<double> weights{3.2, 4.7, 2.1, 5.5, 9.8, 7.4, 1.6, 9.3};
std::cout << "Printing out all the weights: " << std::endl;
for (std::vector<double>::iterator it = weights.begin(); it != weights.end();
++it) {
std::cout << *it << " ";
}
std::cout << std::endl;
std::map<std::string, std::string> abbrevs{{"AL", "Alabama"},
{"CA", "California"},
{"GA", "Georgia"},
{"TX", "Texas"}};
std::map<std::string, double> populations{
{"CA", 39.2}, {"GA", 10.8}, {"AL", 5.1}, {"TX", 29.5}};
std::cout << "nPrinting out the state populations: " << std::endl;
for (auto it = populations.begin(); it != populations.end(); ++it) {
std::string state_abbrev = it->first;
double population = it->second;
std::string state_full = abbrevs[state_abbrev];
std::cout << "Population of " << state_full << ": " << population
<< " million" << std::endl;
}
std::cout << std::endl;
std::vector<Plane> fleet;
Plane p1;
fleet.push_back(p1);
Plane p2(150, 75, "New York City");
fleet.push_back(p2);
Plane p3(220, 220, "Atlanta");
Plane p4(75, 75, "Guatemala City");
Plane p5(125, 94, "Medellin");
fleet.push_back(p3);
fleet.push_back(p4);
fleet.push_back(p5);
std::cout << "nPrinting out all the full flights:" << std::endl;
for (std::vector<Plane>::iterator it = fleet.begin(); it != fleet.end();
++it) {
if (it->GetPassengerCount() == it->GetSeatCount()) {
std::cout << it->GetPassengerCount() << " passengers flying to "
<< it->GetDestination() << std::endl;
}
}
std::cout << "nPrinting out all the weights in reverse: " << std::endl;
for (std::vector<double>::reverse_iterator rit = weights.rbegin();
rit != weights.rend(); ++rit) {
std::cout << *rit << " ";
}
std::cout << std::endl;
return 0;
}
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team