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

any help would be appriciate it. 1 125 pointslGive the implementation of operato

ID: 3796831 • Letter: A

Question


any help would be appriciate it.

1 125 pointslGive the implementation of operator- 0 for the String class For example, the following code segment String s "the fastest test t 'st'; th fae te. Hint: use the substr0 method. 2. R5 points) There is no push front0 member function in STL vector or in aur own or class, why? Give your own implementation of push front0 member function for Vector, what is the time compledty function? 3 Izs Points wrire method remove(const T & x) forthe List class This method removes all occurrences of x from the implicit parameter, 4. 125 pointsl write a c program that reads from standard input until end-of-file l Dl and counts and outputs the number of ccourrences of the word "the For example. if the input file consists of: This is the test file. Line two, there you go. I'm the master of C+ the output is

Explanation / Answer

#include <iostream>

#include <cstring>

using namespace std;

void count(const char s[],

int counts[],

int size);

int main()

{ int counts;

//Enter a string of characters

cout << "Enter a string: ";

// i.e. any phrase

char s[80];

cin.getline(s,80);

cout << "The number of letters in " << s << " is " << count(s,counts) << endl;

return 0;

}

void count(const char s[],

int counts[26], int size);

{ for (int i = 0; i < strlen(s); i++) { if (isalpha(s[i])) count++; }

for (int i = 0; i < 26; i++)

if ((i + 1) % 10 == 0)

cout << counts[i] << " " << static_cast<char>(i + 'a') << endl; else cout << counts[i] << " " << static_cast<char>(i + 'a') << " ";

return count;

}