Question: Need help figuring out why my code doesn't work. I have: void lowerNoPunctuation (string str, string p){ int i,j; for(i=0;i int b = str.length(); for(j=0;j

 Need help figuring out why my code doesn't work. I have:

Need help figuring out why my code doesn't work. I have:

void lowerNoPunctuation(string str, string p){

int i,j;

for(i=0;i

int b = str.length();

for(j=0;j

if(str[j] == p[i]) str.erase(j,1);

b = str.length()

}

}

for(i=0;i

}

I keep getting:

void lowerNoPunctuation(string str, string p){ int i,j; for(i=0;i int b = str.length();

When comparing sentences we are often not interested in differences in case (UPPERCASE vs lowercase) or punctuation. For this problem, you will be writing a function that takes two string parameters- sentence and punctuation and returns the same string in lowercase (remember the built-in tolower function) and with givern punctuation removed. You must use nested loops. The built lowerNoPunctuation returns a string and takes a two strings as parameters string lowerNoPunctuation(string str, string punch) //Your code here Example Output: string str-"Hello, my name is Inigo Montoya. You killed my father. Prepare to die!" string punct - ".,!? string newStr = lowerNPunctuation(str, punct) cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!