5. Write c++ function that would intake a string and return
the number of occurrences of a given character in that sring
Ex:- if the word is “Colombo” and count the occurrences of
the letter “o” the function would return 3
Answer / qliubrvq
occurrences(string str, char test) {
int len = str.size();
int count = 0;
for (int i = 0; i < len; i++) {
if (str[i] == test) count++;
}
return count;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
How can you create a bulleted list, numbered list and an outline by using bullets and numbering command. Explain with the help of example.
what is the acronym of the term 'C.O.M.P.U.T.E.R' ?
17 Answers Config Systems, Google, Wipro,
How stl is different from the c++ standard library?
what is template and type convertion
why does the execution of a c++ program start with main()???
#define CUBE(x) (x*x*x) main() { int a,b=3; a=cube(b++); printf("%d %d",a,b); } What should be the value of a and b? My calc a=4 but syst a=6 how pls tell me if you know it?
What are the components of stl?
what is an algorithm in terms of STL?
What is the name of your birth place?
What are the various types of stl containers?
Who wrote stl?
Explain how to insert a hyperlink in to an Excel worksheet and save a Word document as a Web page.