[ SOLVED ] My program fail in some cases , how to fix it ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

[ SOLVED ] My program fail in some cases , how to fix it ?

Here I'm for asking about one of my code. Code : https://code.sololearn.com/c4oIOfzTUeV3/?ref=app CHECK CODE I'VE EXPLAINED THERE IN DETAILS I've checked it for 9 cases, Case1+2+3: When your searching word is present at the starting/middle/ending of the sentence. Case4+5+6: case1/2/3+it is a substring of a word which start that word in sentence. Case7+8+9: case1/2/3+and it is a substring of a word which end that word in sentence. In SoloLearn , Case 3 , 6 and 9 are not giving expected output it fail if the searching word is at end of the sentence , it's working fine in my phone's compiler , an app named CODING C. You can test in CODING C so you can be sure , I'm right. I've posted it in QnA because I wanted to know why this code is not working properly in same cases while working in other compiler . I know it's because there are some restrictions in SoloLearn compilation but I don't know which and how fix ! I've provided the code , read question carefully and give it try. Thanks MARTIAN TAYLOR 🙏

11th Oct 2020, 12:34 PM
vaibhav
vaibhav - avatar
4 Answers
+ 7
SEE THIS , I've explained my question in code , I can't do that here because of 1024 characters limitations 😅. So if you wanna know details , see the code then 👍.
11th Oct 2020, 12:44 PM
vaibhav
vaibhav - avatar
+ 7
Martin Taylor 1st case you mentioned has been solved already , 2nd case you mentioned was not in my requirement however i have a diffrent way to for that result approach. Thanks for your guidence , thanks for that hint too ☺️👏
11th Oct 2020, 10:32 PM
vaibhav
vaibhav - avatar
+ 5
Martin Taylor thanks your suggestions worked 😊👍 I've understood now why it fails , actually I'm using fgets and fgets store \n too and that cause the error . for punctuation characters I can use their ASCII value to filter but this is not in requirement for now . I've checked your profile and it seems like your professional in c/cpp 😀. it will be beneficial to learn from you 😊.
11th Oct 2020, 4:25 PM
vaibhav
vaibhav - avatar
+ 4
Martin Taylor i realize the library function , however i was instructed to not use that . And thanks for the answer of 183 line , i wish to try it and give you feedback.
11th Oct 2020, 4:20 PM
vaibhav
vaibhav - avatar