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 |
tell about sorted linked list
write a program to convert a decimal number in to its equivalent binary number?
Do you like to Submit Questions in Bulk under Same Category?? Then use our Bulk ListerDo you like to Submit Questions in Bulk under Same Category?? Then use our Bulk Lister
In what cases using of a 'template' is a better approach then using of a 'base class'?
6 Answers Lucent, Mind Tree, Wipro,
What does stl stand for in basketball?
write a c++ program to create an object of a class called employee containing the employee code name designation basic salarry HRA Da gross salary as data 10 such objects "members process "
write a piece of c++ code which allocate memory to the 50 object of type CObj
Describe the elements of Microsoft Word screen. Write down steps for creating, saving, retrieving, editing and printing a document.
What do you mean by stl?
Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fork(); if(!ret) printf("sun"); else printf("solaris");
What is meant by stl in c++?
When did c++ add stl?