Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are an unnamed TA attending Professor Rizk's meeting. She always catches you getting distracted so she decides to make you write a program
You are an unnamed TA attending Professor Rizk's meeting. She always catches you getting distracted so she decides to make you write a program for her to sort out your thoughts whenever she catches you on your phone. You may have a short attention span but you are a clever TA. Your students are free labor. You will get them to write their program for you or you will fail them and Professor Rizk will never ever find out. Professor Rizk is so cool -> Huh? What did Professor Rizk say? -> Say something she is getting mad -> Neck on froze (huh huh) -> Cool A/C air blowing down my neck This is your train of thought. They are linked together. Normally, the last sentence of one thought should be the first sentence of the next consecutive thought. However, these thoughts are scrambled up. This is what it looks like when you sort out your thoughts. Professor Rizk is so cool -> Cool A/C air blowing down my neck -> Neck on froze (huh huh) -> Huh? What did Profesor Rizk say? -> Say something she is getting mad During lab, you will give your students a text files containing your thoughts and they will output your thoughts in a connected, sorted order. Input (MUST MATCH) Professor Rizk is so cool Huh? What did Professor Rizk say? Say something she is getting mad Neck on froze (huh huh) Cool A/C air blowing down my neck Output/sunny input-input1.txt output-outputl.txt Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Input (MUST MATCH) Neck fly as a jet Keep a gold chain on my neck. Jet boy better treat me with With respect Output/sunny input-inputl.txt output-outputl.txt Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect Input (MUST MATCH) Recall some are dead, and some are living With lovers and friends, I still can recall Living in my life, I've loved them all my There are places I'll remember All Remain all these places had their moments with My life, though some have changed Some forever, not for better Better some have gone, and some remain All my life, though some have changed some Output/sunny input-input1.txt output-outputl.txt There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed. #include #include #include #include using namespace std; // This is a class that can parse the commnad line arguments we use in COSC 2430 homework. class ArgumentManager { private: map m_argumentMap; public: Argument Manager () { } Argument Manager (int argc, char *argv[], char delimiter=';'); Argument Manager (string rawArguments, char delimiter=';'); void parse(int argc, char *argv[], char delimiter=';'); void parse (string rawArguments, char delimiter=';'); string get (string argumentName); string toString(); friend ostream& operator < < currentArgumentName.str(""); currentArgumentValue.str(""); argumentName Finished = false; } else if (rawArguments[i] == =) { argumentName Finished = true; } else { if (argumentName Finished) { currentArgument Value < < rawArguments[i]; spaces in argument names. } } else { (rawArguments[i] '') } // ignore any void } if currentArgument Name < < < rawArguments [i]; } == continue; void Argument Manager::parse (int argc, char *argv[], char delimiter) { if (argc > 1) { i++) { delimiter); } } } ArgumentManager::ArgumentMana ger (int argc, char *argv[], char delimiter) { for (int i=1; i //If the argument is not found, return a blank string. if (iter == m_argumentMap.end()) { return ""; } } } else { } string Argument Manager::toString() { stringstream ss; for (map ::iterator iter = m_argumentMap.begin(); != m_argumentMap.end(); iter++) { ss < < "Argument name: < < iter->first < < endl; ss < < "Argument value: < < iter->second < < endl; } return ss.str(); } return iter->second; 11 iter ostream& operator < < (ostream &out, Argument Manager &am) { out < < am.toString(); return out; Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed You are an unnamed TA attending Professor Rizk's meeting. She always catches you getting distracted so she decides to make you write a program for her to sort out your thoughts whenever she catches you on your phone. You may have a short attention span but you are a clever TA. Your students are free labor. You will get them to write their program for you or you will fail them and Professor Rizk will never ever find out. Professor Rizk is so cool -> Huh? What did Professor Rizk say? -> Say something she is getting mad -> Neck on froze (huh huh) -> Cool A/C air blowing down my neck This is your train of thought. They are linked together. Normally, the last sentence of one thought should be the first sentence of the next consecutive thought. However, these thoughts are scrambled up. This is what it looks like when you sort out your thoughts. Professor Rizk is so cool -> Cool A/C air blowing down my neck -> Neck on froze (huh huh) -> Huh? What did Profesor Rizk say? -> Say something she is getting mad During lab, you will give your students a text files containing your thoughts and they will output your thoughts in a connected, sorted order. Input (MUST MATCH) Professor Rizk is so cool Huh? What did Professor Rizk say? Say something she is getting mad Neck on froze (huh huh) Cool A/C air blowing down my neck Output/sunny input-input1.txt output-outputl.txt Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Input (MUST MATCH) Neck fly as a jet Keep a gold chain on my neck. Jet boy better treat me with With respect Output/sunny input-inputl.txt output-outputl.txt Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect Input (MUST MATCH) Recall some are dead, and some are living With lovers and friends, I still can recall Living in my life, I've loved them all my There are places I'll remember All Remain all these places had their moments with My life, though some have changed Some forever, not for better Better some have gone, and some remain All my life, though some have changed some Output/sunny input-input1.txt output-outputl.txt There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed. #include #include #include #include using namespace std; // This is a class that can parse the commnad line arguments we use in COSC 2430 homework. class ArgumentManager { private: map m_argumentMap; public: Argument Manager () { } Argument Manager (int argc, char *argv[], char delimiter=';'); Argument Manager (string rawArguments, char delimiter=';'); void parse(int argc, char *argv[], char delimiter=';'); void parse (string rawArguments, char delimiter=';'); string get (string argumentName); string toString(); friend ostream& operator < < currentArgumentName.str(""); currentArgumentValue.str(""); argumentName Finished = false; } else if (rawArguments[i] == =) { argumentName Finished = true; } else { if (argumentName Finished) { currentArgument Value < < rawArguments[i]; spaces in argument names. } } else { (rawArguments[i] '') } // ignore any void } if currentArgument Name < < < rawArguments [i]; } == continue; void Argument Manager::parse (int argc, char *argv[], char delimiter) { if (argc > 1) { i++) { delimiter); } } } ArgumentManager::ArgumentMana ger (int argc, char *argv[], char delimiter) { for (int i=1; i //If the argument is not found, return a blank string. if (iter == m_argumentMap.end()) { return ""; } } } else { } string Argument Manager::toString() { stringstream ss; for (map ::iterator iter = m_argumentMap.begin(); != m_argumentMap.end(); iter++) { ss < < "Argument name: < < iter->first < < endl; ss < < "Argument value: < < iter->second < < endl; } return ss.str(); } return iter->second; 11 iter ostream& operator < < (ostream &out, Argument Manager &am) { out < < am.toString(); return out; Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed You are an unnamed TA attending Professor Rizk's meeting. She always catches you getting distracted so she decides to make you write a program for her to sort out your thoughts whenever she catches you on your phone. You may have a short attention span but you are a clever TA. Your students are free labor. You will get them to write their program for you or you will fail them and Professor Rizk will never ever find out. Professor Rizk is so cool -> Huh? What did Professor Rizk say? -> Say something she is getting mad -> Neck on froze (huh huh) -> Cool A/C air blowing down my neck This is your train of thought. They are linked together. Normally, the last sentence of one thought should be the first sentence of the next consecutive thought. However, these thoughts are scrambled up. This is what it looks like when you sort out your thoughts. Professor Rizk is so cool -> Cool A/C air blowing down my neck -> Neck on froze (huh huh) -> Huh? What did Profesor Rizk say? -> Say something she is getting mad During lab, you will give your students a text files containing your thoughts and they will output your thoughts in a connected, sorted order. Input (MUST MATCH) Professor Rizk is so cool Huh? What did Professor Rizk say? Say something she is getting mad Neck on froze (huh huh) Cool A/C air blowing down my neck Output/sunny input-input1.txt output-outputl.txt Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Input (MUST MATCH) Neck fly as a jet Keep a gold chain on my neck. Jet boy better treat me with With respect Output/sunny input-inputl.txt output-outputl.txt Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect Input (MUST MATCH) Recall some are dead, and some are living With lovers and friends, I still can recall Living in my life, I've loved them all my There are places I'll remember All Remain all these places had their moments with My life, though some have changed Some forever, not for better Better some have gone, and some remain All my life, though some have changed some Output/sunny input-input1.txt output-outputl.txt There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed. #include #include #include #include using namespace std; // This is a class that can parse the commnad line arguments we use in COSC 2430 homework. class ArgumentManager { private: map m_argumentMap; public: Argument Manager () { } Argument Manager (int argc, char *argv[], char delimiter=';'); Argument Manager (string rawArguments, char delimiter=';'); void parse(int argc, char *argv[], char delimiter=';'); void parse (string rawArguments, char delimiter=';'); string get (string argumentName); string toString(); friend ostream& operator < < currentArgumentName.str(""); currentArgumentValue.str(""); argumentName Finished = false; } else if (rawArguments[i] == =) { argumentName Finished = true; } else { if (argumentName Finished) { currentArgument Value < < rawArguments[i]; spaces in argument names. } } else { (rawArguments[i] '') } // ignore any void } if currentArgument Name < < < rawArguments [i]; } == continue; void Argument Manager::parse (int argc, char *argv[], char delimiter) { if (argc > 1) { i++) { delimiter); } } } ArgumentManager::ArgumentMana ger (int argc, char *argv[], char delimiter) { for (int i=1; i //If the argument is not found, return a blank string. if (iter == m_argumentMap.end()) { return ""; } } } else { } string Argument Manager::toString() { stringstream ss; for (map ::iterator iter = m_argumentMap.begin(); != m_argumentMap.end(); iter++) { ss < < "Argument name: < < iter->first < < endl; ss < < "Argument value: < < iter->second < < endl; } return ss.str(); } return iter->second; 11 iter ostream& operator < < (ostream &out, Argument Manager &am) { out < < am.toString(); return out; Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed You are an unnamed TA attending Professor Rizk's meeting. She always catches you getting distracted so she decides to make you write a program for her to sort out your thoughts whenever she catches you on your phone. You may have a short attention span but you are a clever TA. Your students are free labor. You will get them to write their program for you or you will fail them and Professor Rizk will never ever find out. Professor Rizk is so cool -> Huh? What did Professor Rizk say? -> Say something she is getting mad -> Neck on froze (huh huh) -> Cool A/C air blowing down my neck This is your train of thought. They are linked together. Normally, the last sentence of one thought should be the first sentence of the next consecutive thought. However, these thoughts are scrambled up. This is what it looks like when you sort out your thoughts. Professor Rizk is so cool -> Cool A/C air blowing down my neck -> Neck on froze (huh huh) -> Huh? What did Profesor Rizk say? -> Say something she is getting mad During lab, you will give your students a text files containing your thoughts and they will output your thoughts in a connected, sorted order. Input (MUST MATCH) Professor Rizk is so cool Huh? What did Professor Rizk say? Say something she is getting mad Neck on froze (huh huh) Cool A/C air blowing down my neck Output/sunny input-input1.txt output-outputl.txt Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Input (MUST MATCH) Neck fly as a jet Keep a gold chain on my neck. Jet boy better treat me with With respect Output/sunny input-inputl.txt output-outputl.txt Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect Input (MUST MATCH) Recall some are dead, and some are living With lovers and friends, I still can recall Living in my life, I've loved them all my There are places I'll remember All Remain all these places had their moments with My life, though some have changed Some forever, not for better Better some have gone, and some remain All my life, though some have changed some Output/sunny input-input1.txt output-outputl.txt There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed. #include #include #include #include using namespace std; // This is a class that can parse the commnad line arguments we use in COSC 2430 homework. class ArgumentManager { private: map m_argumentMap; public: Argument Manager () { } Argument Manager (int argc, char *argv[], char delimiter=';'); Argument Manager (string rawArguments, char delimiter=';'); void parse(int argc, char *argv[], char delimiter=';'); void parse (string rawArguments, char delimiter=';'); string get (string argumentName); string toString(); friend ostream& operator < < currentArgumentName.str(""); currentArgumentValue.str(""); argumentName Finished = false; } else if (rawArguments[i] == =) { argumentName Finished = true; } else { if (argumentName Finished) { currentArgument Value < < rawArguments[i]; spaces in argument names. } } else { (rawArguments[i] '') } // ignore any void } if currentArgument Name < < < rawArguments [i]; } == continue; void Argument Manager::parse (int argc, char *argv[], char delimiter) { if (argc > 1) { i++) { delimiter); } } } ArgumentManager::ArgumentMana ger (int argc, char *argv[], char delimiter) { for (int i=1; i //If the argument is not found, return a blank string. if (iter == m_argumentMap.end()) { return ""; } } } else { } string Argument Manager::toString() { stringstream ss; for (map ::iterator iter = m_argumentMap.begin(); != m_argumentMap.end(); iter++) { ss < < "Argument name: < < iter->first < < endl; ss < < "Argument value: < < iter->second < < endl; } return ss.str(); } return iter->second; 11 iter ostream& operator < < (ostream &out, Argument Manager &am) { out < < am.toString(); return out; Professor Rizk is so cool Cool A/C air blowing down my neck Neck on froze (huh huh) Huh? What did Professor Rizk say? Say something she is getting mad Keep a gold chain on my neck Neck fly as a jet Jet boy better treat me with With respect There are places I'll remember All All my life, though some have changed some Some forever, not for better Better some have gone, and some remain Remain all these places had their moments with With lovers and friends, I still can recall Recall some are dead, and some are living Living in my life, I've loved them all my My life, though some have changed
Step by Step Solution
★★★★★
3.49 Rating (162 Votes )
There are 3 Steps involved in it
Step: 1
Answer 1 The program can be written in any programming language The goal of the program is to take an input file containing a list of scrambled thoughts and output them in a connected sorted order The ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started