-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlab_string_search.cpp
More file actions
44 lines (39 loc) · 955 Bytes
/
lab_string_search.cpp
File metadata and controls
44 lines (39 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
using namespace std;
bool search_string( string text, string substr )
{
// COMPLETE ME
return false;
}
int main()
{
int errflg = 1;
string text = "This is the big piece of text that we are going to be searching in";
if( search_string( text, "This" ) != true )
{
cerr << "Failed \"This\" test." << endl;
}
else if( search_string( text, "Thiss" ) != false )
{
cerr << "Failed \"Thiss\" test." << endl;
}
else if( search_string( text, "big" ) != true )
{
cerr << "Failed \"big\" test." << endl;
}
else if( search_string( text, "in" ) != true )
{
cerr << "Failed \"in\" test." << endl;
}
else if( search_string( text, "kermit" ) == true )
{
cerr << "Failed \"kermit\" test." << endl;
}
else
{
cout << "Passed all tests." << endl;
errflg = 0;
}
return errflg;
}