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 |
draw a flowchart that accepts two numbers and checks if the first is divisible by the second.
How do I convert a stl file?
What is the STL?
Write a program in C/C++ to implement reader- writer problem
how to overload << and >> operator in c++
write a c++ to define a class box with length,breadth and height as data member and input value(),printvalue() and volume() as member functions.
what's the difference between function overloading and function overiding?
why does the execution of a c++ program start with main()???
What two types of containers does the stl provide?
if 4-5 year old brother is standing on d roof with me and watching d moon, suddenly moon coverd by cloud then how will i explain d hiding of moon to my brother.
Explain when u will use Observer pattern and how u will implement in c++ .
what is compiler?