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

I have written a code that parses through a file reading it line by line and spl

ID: 3550795 • Letter: I

Question

I have written a code that parses through a file reading it line by line and splitting it into tokens by white space. But I want a pair of single quotes to be one token, not how many words are in it,

For example I want something like

Done a'ccept command' Done

to be three tokens not four the three bieng

first Done second a'ccept command' third bieng Done.

So far I have

void file_parser::check_quote(tokens<v>) {

boolean has_quote;

for (int i = 0; i <= tokens.size(); i++) {

String temp = tokens.c_str();

for (int i = 0; i <= tokens.size(); i++) {

if (tmp[i] == ''') {

has_quote = true;

int FirstQuote = i;

}

if (has_quote && i != FirstQuote && tmp[i] == ''') {

int SecondQuote = i;

for (int k = FirstQuote; k <= SecondQuote; i++) {

}

}

}

}

Explanation / Answer

For resloving this Condtion
you must Put Special Case in their loop and use if statment


for (int i = 0; i <= tokens.size(); i++) {

if (tmp[i] == '' ' ") {

do{

if (temp1[x]=" "){

temp[i]="";

}while(temp[i]!=" ' ");

}

}