Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Based on the main function on the left, get the int GetFileStats(string filename, string& firstKey, string& firstValue) call function to open, read the (key,value) pairs

Based on the main function on the left, get the
int GetFileStats(string filename, string& firstKey, string& firstValue) call function to open, read the (key,value) pairs from the file, count how many pairs there are and return the value N. image text in transcribed
string E zyBooks Library> CS 109 home > 7.9: P07 Searching files for (key, value) pairs Current file search.cpp 12 I GetFilestats 14 // Returns the * (key, valu) pain in the Elven .ile. Also reurnth. 11nt pay.-alue) 15 / pair via the paraneters firstkey and fiestvalue 16 1 17 // Nott: it i, assured t #13e cont ainJae least ont (key, valus) int N, rank string key pair, in this format bool found 19 t value ky e value kay 21 valse key cout s endt 24 11 where value and key are one word strings (or nubers that will be iegut as strings). 1 the file cannet be opened,the ogan will be exited /I Now let's irput kays fron the hyboard and look for thee in the cin > key s 1 27 in GetFileStat s(strizg rilena e, string41rsttey, strings eirstValue) 28 t 29 Initialize return value/parmeters chile (hry 32 firstkey-P i4 (found - true) 36 37 // Too; open-d real the (key, value) pairfrv. the 'ile. The ea.. IS 8to sisply count hw nany pairs there are and return this value N. Also 19 //m need to return the first (key, value) pai, via the 'irstKey 40 // #1rstialue Paramtersi Just assign to the par-ters to-re.rn the 41 s. t forget te close the tsle shen you're done 42 cout e Rank et rank enel lse f not found cin > key, 67 coEnd endl

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

Step: 3

blur-text-image

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

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago