Computers and Technology

C++ Zip code and population (class templates)
Define a class StatePair with two template types (T1 and T2), a constructor, mutators, accessors, and a PrintInfo() method. Three vectors have been pre-filled with StatePair data in main():
vector> zipCodeState: ZIP code - state abbreviation pairs
vector> abbrevState: state abbreviation - state name pairs
vector> statePopulation: state name - population pairs
Complete main() to use an input ZIP code to retrieve the correct state abbreviation from the vector zipCodeState. Then use the state abbreviation to retrieve the state name from the vector abbrevState. Lastly, use the state name to retrieve the correct state name/population pair from the vector statePopulation and output the pair.
Ex: If the input is:
21044
the output is:
Maryland: 6079602
//main. cpp
#include
#include
#include
#include
#include "StatePair. h"
using namespace std;
int main() {
ifstream inFS; // File input stream
int zip;
int population;
string abbrev;
string state;
unsigned int i;
// ZIP code - state abbrev. pairs
vector> zipCodeState;
// state abbrev. - state name pairs
vector> abbrevState;
// state name - population pairs
vector> statePopulation;
// Fill the three ArrayLists
// Try to open zip_code_state. txt file
inFS. open("zip_code_state. txt");
if (!inFS. is_open()) {
cout << "Could not open file zip_code_state. txt." << endl;
return 1; // 1 indicates error
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:50, Isaiahtate053
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
image
Computers and Technology, 22.06.2019 17:50, ImBADatmath8743
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
image
Computers and Technology, 23.06.2019 03:30, natalie2sheffield
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
image
Computers and Technology, 23.06.2019 12:50, tommy4260
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
Do you know the correct answer?
C++ Zip code and population (class templates)
Define a class StatePair with two template typ...

Questions in other subjects:

Konu
Mathematics, 09.01.2021 01:00
Konu
Mathematics, 09.01.2021 01:00
Konu
History, 09.01.2021 01:00