Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <cstring>
- #include <stdio.h>
- #include <stdlib.h>
- using namespace std;
- bool search(vector< vector<char> > &test, char *word, int x, int y){
- bool answer = false;
- if(strlen(word) > (test.size()-y)){
- return false;
- }
- else{
- for(int i = 0; i < strlen(word); i++){
- if(word[i] == test[x][y + i])
- answer = true;
- else
- answer = false;
- break;
- }
- }
- return answer;
- }
- int main(int argc, char *argv[]){
- int x, y;
- string word;
- cin >> x;
- cin >> y;
- vector< vector<char> > test;
- test.resize(10);
- for(int i = 0; i < test.size(); i++){
- test[i].resize(y);
- }
- for (int i = 0; i < x; i++) {
- for (int j = 0; j<y ; j++){
- cin >> test[i][j];
- }
- }
- for(int i = 0; i < x; i++) {
- for(int j = 0; j < y; j++){
- cout << test[i][j] << " ";
- }
- cout << endl;
- }
- cin >> word;
- cout << word;
- bool hatesearch = search(test, argv[1], atoi(argv[2]), atoi(argv[3]));
- if(hatesearch){
- cout << "true" << endl;
- }
- else{
- cout << "false" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement