Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Programming Language The code below gives the correct answer but is marked wrong in the checking software. Is there any alternative ways to do

C Programming Language

image text in transcribed

The code below gives the correct answer but is marked wrong in the checking software. Is there any alternative ways to do this problem? The focus is on functions and recursion

#include

#include

int checkString(char string[])

{

for(int i = 0; i

{

if(string[i] == 103 || string[i] == 71 && string[i+1] == 111 || string[i+1] == 79 && string[i+2] == 111 || string[i+1] == 79 && string[i+3] == 100 || string[i+1] == 68)

{

return 1;

break;

}

}

}

int goodCheck()

{

char string[80] = {'0'};

fgets(string, 80, stdin);

if(checkString(string)==1)

{

return 3;

}

else

{

return 0;

}

}

int main()

{

int cases = 0;

char string[80];

scanf("%d", &cases);

fflush(stdin);

for(int i = 1; i

{

if (goodCheck() == 3)

{

printf("Case #%d: yes ", i);

}

else

{

printf("Case #%d: no ", i);

}

}

}

Good In this problem, you should check whether there is 'good' or not in a line Format Input The input begins with an integer T indicating the number of test cases. In each test case, there is a line of string S Format Output For each line of input, print yes if the line contains 'good', and no otherwise. Any capitalization of 'good counts as an occurrence Constraints 1

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

(4) What level of commitment do people have towards the strategy?

Answered: 1 week ago

Question

(2) What do they not do so well?

Answered: 1 week ago

Question

(5) How does it help you make decisions about resources and budget?

Answered: 1 week ago