Question: 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
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
Get step-by-step solutions from verified subject matter experts
