string debug problem

I don't know why it doesn't work,i tried to debug it but at line 85 the debugger arrow disappear, is anyone has any conclusion for that ??!!


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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
     int n,w,c,c_lines,new_i=0;

            cin>>n;

          int counter=0,able=1;

          string s[n+1];
          string grid1;
          vector<string> grid;

          for(int i=0;i<=n;i++)
            {
              getline(cin,s[i]);
            }

            cin>>c_lines;
            string word[c_lines];
            if(c_lines>=1&&c_lines<10)
            {
                for(int i=0;i<c_lines;i++)
            {
                cin>>word[i];
            }
            }

         for(int i=1;i<=c_lines;i++)
         {
             int counter_word=0;
             if(n>=1&&n<=10)
                {
             int size_string=s[i].length()-1;
             for(int j=0;j<=size_string;j++)
                {
                    if(j==0)
                    {counter=0;}
                    if(s[i].at(j)!=' '&&s[i].at(j)!=NULL)
                      {counter++;}
                    else{counter=0;}

                    if(isalpha(s[i].at(j)))
                       {
                           if(isupper(s[i].at(j)))
                           {
                               able=0;
                               break;
                           }
                       }

                    if(counter>20)
                    {
                        able=0;
                        break;
                    }

                     }

                   if(counter<1)
                   {
                       able=0;
                   }
                if(able==0)
                {
                    break;
                }


         int size_string1=s[i].length();
         int length=word[i-1].length();
         for(int j=0;j<=size_string1;j++)
          {
              if(able==1)
                {
                  grid1=s[i].substr(j,length);

                  if(grid1==word[i-1])
                  {
                      counter_word++;
                  }
                }
          }

                  }

                  cout<<counter_word<< endl;
                  }

     return 0;
}
Last edited on
What do you mean, "it doesn't work"? What incorrect behaviour are you seeing? What is the expected behaviour? What is this even supposed to do?

Why are you being so vague and withholding information from us? Don't you want us to be able to help you?
I don't think your program is compiling..
line #19 string s[n+1]; should throw an error
Topic archived. No new replies allowed.