Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a c++ question. I am given a txt file with key value pairs. For example, each line will read something like cat 5000

This is a c++ question. I am given a txt file with key value pairs. For example, each line will read something like "cat 5000" or "dog 199" (without quotes). There are several lines with values like this. How can I read in these string and number values into a vector if, for example, I am given the code below to make the "sortData" function work?

class sortData

{

public:

//Required function to read file, make dictionary with values

sortData(string filename.txt);

private:

//class to store a string and number value.

class Data

{

public:

string s;

int number;

};

};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago

Question

Conduct a needs assessment. page 269

Answered: 1 week ago