Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can you say why build failed?

0 votes
asked Oct 21, 2018 by Serajum54575 (120 points)
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n, f, i, L, R, K, sum = 0, length, flag = 0;
  scanf("%d %d", &n, &f);
  char x[26];
  cout << "Enter a string: ";
  cin >> x;
  if(x[26] >= 'z' && x[26] <= 'a'){
     for(i=1; i<=f; i++){
        scanf("%d %d %d", &L, &R, &K);
        for(i=L; i<=R; i++){
           sum += i;
        }
     }
  }
  if(sum == K){
     if(x[i] != x[length-i-1]){
            flag = 1;
            break;
     }
  }

    if (flag) {
        cout << x << " no.." << endl;
    }
    else {
        cout << x << " yes.." << endl;
    }
    system("pause");
    return 0;
}

1 Answer

0 votes
answered Oct 22, 2018 by anonymous

this is wrong "  if(x[26] >= 'z' && x[26] <= 'a')"you cant compare like 'a'>'b' or 'z'<='k' etc. this meanless and unuseful

you must be sure exactly  R>= L, "for(i=L; i<=R; i++)"

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...