Question: Please be accurate with your work. Please fix my (C) program. I will post the directions, example of the output, and my program with the

Please be accurate with your work.

Please fix my (C) program. I will post the directions, example of the output, and my program with the current grade(3/6) of my program. My program is almost complete, but I need someone to modify it so it dosn't use gets(), I need it to use fgets().

Here are the directions:

Please be accurate with your work. Please fix my (C) program. I

Here is my program that needs fixed:

#include

#include

//Returns the number of characters in usrStr

int GetNumOfCharacters(const char usrStr[]) {

/* Type your code here. */

int count = 0;

int i = 0;

for(i=0; i

count++;

return count;

}

void OutputWithoutWhitespace(const char usrStr[]){

printf("string with no whitespace: ");

int i = 0;

for(i=0; i

if(usrStr[i] != ' ' && usrStr[i] != '\t')

printf("%c", usrStr[i]);

printf(" ");

}

int main(void) {

/* Type your code here. */

char usrStr[50];

printf("Enter a sentence or phrase: ");

gets(usrStr);

printf(" You entered: %s ", usrStr);

printf("Number of characters: %d ", GetNumOfCharacters(usrStr));

OutputWithoutWhitespace(usrStr);

return 0;

}

The grading of my program submission is here: ( As you can see, 4, 5, and 6 are incorrect. I need these to be correct. Please remember to include fgets() instead of gets(). ) (Note: 4, 5, and 6 are incorrect by one number, please fix this) Thanks!!

will post the directions, example of the output, and my program with

the current grade(3/6) of my program. My program is almost complete, butI need someone to modify it so it dosn't use gets(), I

(1) Prompt the user to enter a string of their choosing. Output the string. (1 pt) Ex: Enter a sentence or phrase The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself (2) Complete the GetNumOfCharacters0 function, which returns the number of characters in the user's string. We encourage you to use a for loop in this function. (2 pts) (3) In main0, call the GetNumOfCharacters0 function and then output the returned result. (1 pt) (4) Implement the OutputWithoutWhitespace0 function. OutputWithoutWhitespace0 outputs the string's characters except for whitespace (spaces, tabs). Note: A tab is \t'. Call the OutputWithoutWhitespace0 function in mano. (2 pts) Ex: Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. Number of characters: 46 String with no whitespace: Theonlythingwehavetofearisfearitself

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!