brute_force_string_searching.cpp File Reference

String pattern search - brute force. More...

`#include <iostream>`
`#include <cstring>`
`#include <vector>`
Include dependency graph for brute_force_string_searching.cpp:

## Namespaces

| string_search
| String search algorithms.

## Functions

int | string_search::brute_force (const std::string &text, const std::string &pattern)
int | main ()

## Variables

const std::vector< std::vector< std::string > > | test_set

## Detailed Description

String pattern search - brute force.

## Function Documentation

## main()

int main | ( | void |  | ) |

Main function

{
for (size_t i = 0; i < test_set.size(); i++) {
int output = brute_force(test_set[i][0], test_set[i][1]);
if (std::to_string(output) == test_set[i][2])
std::cout << "success\n";
else
std::cout << "failure\n";
}
return 0;
}
std::cout
test_set
const std::vector< std::vector< std::string > > test_set
Definition: brute_force_string_searching.cpp:41
string_search::brute_force
int brute_force(const std::string &text, const std::string &pattern)
Definition: brute_force_string_searching.cpp:21
std::to_string
T to_string(T... args)
Here is the call graph for this function:

## Variable Documentation

## test_set

const std::vector<std::vector<std::string> > test_set

Initial value:
= {
{"a", "aa", "-1"}, {"a", "a", "0"}, {"ba", "b", "0"},
{"bba", "bb", "0"}, {"bbca", "c", "2"}, {"ab", "b", "1"}}

set of test cases