Concepts: functions, strings, problem-solving
Description: Write a program that creates and uses a function called myGoodness. This function takes a string as
input and returns the goodness of the string. The goodness of a string is calculated in the following way: If the string
contains any letters except for 0 or 1, then its goodness is 0. Otherwise, its goodness is the number of 1's in the
string.
Note: You do not need to validate input for this lab
Definition of SIZE and prototype of function myGoodness is given below. Function myGoodness must be written
using this prototype (DO NOT change the prototype).
#define SIZE 100
Function name: myGoodness
Prototype: int myGoodness (char [SIZE]);
To test this function, your main program must call myGoodness 5 times. At the end, it must print the sum of
goodness of all input strings. Please follow the sample input/output for further clarification.
Sample Input/output:
Enter String # 1: 1000001
Goodness of 1000001 = 2
Enter String # 2: 1111100000
Goodness of 1111100000 = 5
Enter String # 3: 0000011111
Goodness of 0000011111 = 5
Enter String # 4: xyz
Goodness of xyz = 0
Enter String # 5: 111111x111
Goodness of 111111x111 = 0
Total goodness today = 12