Question: I receive these errors for the play.cpp file i ' m working on . Here's my file: / / play . cpp #include #include #include
I receive these errors for the play.cpp file im working on Here's my file:
playcpp
#include
#include
#include
using std::string;
using std::vector;
using std::map;
using std::cout;
using std::endl;
#include "play.h
#include "playTools.h
Speech::Speechstring speaker, vector lines
initialize theSpeaker and theLines
to speaker and lines
thistheSpeaker speaker;
thistheLines lines;
string Speech::getSpeaker
return theSpeaker
return theSpeaker;
vector Speech::getLines
return theLines
return theLines;
void Speech::print
print the speech using cout
this is primarily meant for debugging
so print what is useful to you
Id recommend, theSpeaker and each line of the speech
at the very least
cout "Speaker: theSpeaker endl;
for auto& line : theLines
cout line endl;
Scene::Sceneint actNum, int sceneNum, string loc
initialize actNumber, sceneNumber, and location to the
appropriate values
thisactNumber actNum;
thissceneNumber sceneNum;
thislocation loc;
string Scene::toString
return a string of this form:
Act: Scene: Location: Capulet's orchard.
return "Act: std::tostringactNumber Scene: std::tostringsceneNumber Location: location ;
Play::Playstring title
this will take in the title,set theTitle, and use it to generate
theScenes see playTools.cpp theSpeeches see playTools.cpp
and numLines this one you'll have to do yourself
numLines is the total number of lines in the play
this can be found by counting all of the lines in each
speech in theSpeeches
thistheTitle title;
theSpeeches makeListOfSpeechestitle;
theScenes makeListOfScenestitle;
numLines ;
for auto& speech : theSpeeches
numLines speech.getLinessize;
void Play::printAllScenes
this will loop through all of the scenes in theScenes,
call its toString method, and cout each scene on a
separate line
for auto& scene : theScenes
cout scene.toString endl;
vector Play::allParts
this loops through theSpeeches and saves each speaker
but only saves them once.
Hints:
Build up a vector of roles through repeated pushback.
This will involve looking at the speaker associated with every speech
in the play. If the speaker is not already in the current version of
of the vector, then pushback. Otherwise, there is nothing to do because
the speaker is in the vector already.
Note: the list returned by allParts should have no repeated entries
and the order does not matter.
vector roles;
for auto& speech : theSpeeches
string speaker speech.getSpeaker;
if std::findrolesbegin roles.end speaker roles.end
roles.pushbackspeaker;
return roles;
map Play::speakersAndLineCnt
this loops through theSpeeches and counts how many lines
each speaker has, which it saves as a speaker,numLines pair
map speakerCount;
for auto& speech : theSpeeches
speakerCountspeechgetSpeaker speech.getLinessize;
return speakerCount;
int Play::wordFreqstring word
this loops through theSpeeches and counts how many times
the given word appears in the play
int c ;
for auto& speech : theSpeeches
for const auto& line : speech.getLines
c std::countlinebegin line.end word;
return c;
end of play.cpp
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
