Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Char myLyrict[] = \"I\'m all about that bass!\";for (int i = 0; i Solution #incl

ID: 3843488 • Letter: C

Question

Char myLyrict[] = "I'm all about that bass!";for (int i = 0; i

Explanation / Answer

#include #include using namespace std; string artists[100],titles[100]; int nSongs=0; bool loadData(void) { ifstream inFile; string word,artist,title; // must open file AND CHECK! before accessing data inFile.open("lyrics.dat"); if (!inFile) { cout > word; if (!inFile) // stop loop at EOF break; if (word == "artist") { inFile.ignore(8,' '); getline(inFile,artist); // copy artist into array artists[nSongs] = artist; } else if (word == "title") { inFile.ignore(1,' '); getline(inFile,title); // title[nSongs] = title; } else if (word == "startlyrics") { nSongs++; } else { } } } void searchKeys(void) { } int main(void) { bool rc; // return code // load data from lyrics file rc = loadData(); cout