Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is part of a code that i wrote, but compiler give me error please help me : cStrTools.cpp:27:33: warning: comparison between signed and unsigned

this is part of a code that i wrote, but compiler give me error please help me : cStrTools.cpp:27:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (i <= (pfix.size())) { ^ cStrTools.cpp: In function 'bool DIY(std::string, std::string)': cStrTools.cpp:50:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while (i <= (per.size())) { ^ cStrTools.cpp:52:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (X == sec.size() - 1) ^ ---------------------------------------------------------------------------------------- #define _CRT_SECURE_NO_WARNINGS #include  #include  using namespace std; void namelower(string& chac) { for (char& az : chac) az = tolower(az); } int L[1000]; void Prefixcode(string& pfix) { int X = 0; int i = 1; while (i <= (pfix.size())) { if (pfix[i] == pfix[X]) { L[i] = X + 1; i++; X++; } else if (X > 0) X = L[X - 1]; else { L[i] = 0; i++; } } } bool DIY(string per, string sec) { namelower(per); namelower(sec); int X = 0; int i = 0; Prefixcode(sec); while (i <= (per.size())) { if (per[i] == sec[X]) { if (X == sec.size() - 1) return true; X++; i++; } else if (X > 0) { X = L[X - 1]; } else { i++; } } return false; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions