1. Engineering
  2. Computer Science
  3. language is c please use comments...

Question: language is c please use comments...

Question details

language is C++. please use comments2. Program and input specification You will get a list of strings in an input file. Each line will be considered as a single string. You need to find out the length of the common subsequence of characters from those strings which is the longest one. Assumptions: The input file is a small plain text file; no need to handle binary files. Each input file can have maximum 4 strings. A string can have maximum 1000 characters. An input file may contain empty lines between strings, then you will ignore it. The output should be exactly matched with the format. . . . . The main C++ program will become the executable to be tested by the TAs. The Result file should be written to another text file (output file), provided with the Command line. Notice the input and output files are specified in the command line, not inside the C++ code. Notice also the quotes in the program call, to avoid Unix/Windows gets confused. 3. Input and Output The input and output files are regular text files, where each line is terminated with a In character. Each line will be treated as a string. The output file will contain the output. The output will be Len:+ the length of the subsequence. Note, in Len: , there is a space after the colon(:).4. Program Execution: The general call to the executable is as follows Subsequence input-input1.txtoutput-output1.txt You can call the example with another command line type, Subsequence input-input1.txt output output1.txt 5. Examples Example 1 of input and output, Input11.txt abcd321ABCD abcD123ABCd Command line Subsequence input-input11.txt output-output11.txt Output11.txt Len: 7 Example 2 of input and output, Input12.txt Data Structures Using C++ Data Structures Using Java COSC 2430 is Data Structures course Data Structures Command line Subsequence input-input12.txt output-output12.txt Output12.txt Len: 15 Example 3 of input and output, Input13.txt Data Structures is an interesting course // empty line will not be counted We love Data Structures course Command line Subsequence input-input13.txt output-output13.txt Output13.txt Len: 23include <map> include <string> tinclude <iostream> #include isstream» using namespace std; // This is class that can parse the conmnad line areuments class ArgumentManagrf private us in COSC 243A homework nap string, stringmargunentMap; public: Argumen LMaagerE) ArgumentManager(int argc, char *arg, char deliniter- ArgumentManager(string re·Arguments, char delimiter;); void parse(int arec, char arav char delimiter-; void parselstrine rawAreunents, char deliniter-;; string get(string argumentName); tring tostring); triend ostream& operator (ostream &out, ArgumentManager &am); void ArgumentManager: :parse(string arguments, cher delimiter) ( stringstrean currentArgunentName stringstream currentAraunentvalue; bool areunentNameFinished false; (unsigned it (1 认-rawargunents.length(); Il i++) !Argument s Lj for int rawArguments.length() 1-0; { ;; delimit cr) r { (currentArgumentName . str() m_arguneritMap[currentArgument Nane.stcurrentArgumeritValue.str; !- /i reset currentArgumentNane. str( currentArgumentvalue.str argumentamoFinished - false; alse it (rmentsl] argumentNaneFinished true; else ( if (argunentNameFinished) ( currentArgumentValue << rawArgunents[i1; else ignor any spacas in argunent names continuc; currentArgumentName rawArgunents[i]; void ArgumentManager: :parse(int arg, if (arge >1) 1 char ·argv[], char del ini ter) { for (int i-1; i<argc; i)t parse(argv[i), delimiter); ArgunentManager::ArcunentManager (int arac, char *arev, char delimiter) f parse(aree, argv, delimiter); ArgunentManager::ArgunentManager(string awArguents, char deliniter) paseranArguments, deliniter) string ArgumentManager:get (string ergumentNane) nap<string, string:iterator iter m argunentMap.find(rgmentName); If the araument is not found, return a blank string if (iterargumontMap.ond)) t return else return İler->second; strine ArgunentHanager::toStrine stringstream ss for (mapkstring, string»::iterator iter-n_argumentHap.begin); iter n_argumentMap.end); itr i ss くく Argument name : << iter->first くくendl; ss くく Argument value : << iter->second << endl; return ss.str ostreamk operator << (ostrean Rout, AreumentManager am) out < an.taStringe) return out

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution