write a program that reads a series of strings and prints only
those strings begging with letter "b"



write a program that reads a series of strings and prints only those strings begging with letter &..

Answer / Shumaila Haque

Here's a simple C++ code snippet that demonstrates how to print strings starting with the letter 'b':n```cppn#include <iostream>n#include <vector>n#include <algorithm>nnstd::vector<std::string> filterStrings(const std::vector<std::string>& input) {n std::vector<std::string> result;n for (const auto& str : input) {n if (str[0] == 'b') {n result.push_back(str);n }n }n return result;n}nnint main() {n std::vector<std::string> strings = {"apple", "banana", "blueberry", "cherry"};n auto filteredStrings = filterStrings(strings);n for (const auto& str : filteredStrings) {n std::cout << str << ' ';n }n return 0;n}n``

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Code Interview Questions

write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.

1 Answers   HCL, SRCASW,


main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}

1 Answers  


swap prog

3 Answers   TCS,


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

1 Answers   Jomo Kenyatta University,


i don't know about working of nested for loop can any one help me

1 Answers  


write a program that can LOCATE and INSERT elements in array using c++ programming languages.

1 Answers  


how to find out the maximum number out of the three inputs.

6 Answers   ABC, Apple, C3I, HP, TCS,


Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?

3 Answers   TCS,


Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 &#8230;

2 Answers   Mind Tree,


write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000

1 Answers   Alvin,


write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

1 Answers   HCL,


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

1 Answers  


Categories