Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Provide the definitions of at least five required functions: calculateTotalParag

ID: 3666689 • Letter: P

Question

Provide the definitions of at least five required functions: calculateTotalParagraphs(paragraphs) Returns the total number of paragraphs given a book in the form of a list parameter named as paragraphs. The parameter “paragraphs” is a list of lists of strings and represents the contents of a book. Each element in the list is a list of strings, and represents a paragraph in the book. The strings inside a list represent the words of a paragraph. calculateTotalWords(paragraphs) Returns the total number of words given a book in the form of a list of lists of strings using parameter paragraphs. searchLongestParagraph(paragraphs) Returns the paragraph number and total number of words of the paragraph that has the largest number of words. The parameter paragraphs is the same as above functions. displayCommonWords(paragraphs) Returns a list of all common words that have appeared in 5 or more paragraphs. main() function is the driver that invokes other functions, and produces the program output You may define extra functions, but the above five functions are required b) Include sufficient comments for the project, functions, and some particular statements

Explanation / Answer

Source Code to Calculated Length without Using strlen() Function

#include <stdio.h>

int main()

{

    char s[1000],i;

    printf("Enter a string: ");

    scanf("%s",s);

    for(i=0; s[i]!=''; ++i);

   printf("Length of string: %d",i);

    return 0;

}

Output

Enter a string: Programiz

Length of string: 9

C Program to Find the Largest & Smallest Word in a String

This C Program finds the largest and smallest possible word in a string.

Here is a source code of the C program to find the largest and smallest possible word in a string. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

*

* C Program to Find the Largest & Smallest Word in a String

/

#include <stdio.h>

#include <string.h>

#include <ctype.h>

int main()

{

    char string[100], word[20], max[20], min[20], c;

    int i = 0, j = 0, flag = 0;

    printf("Enter string: ");

    i = 0;

    do

    {

        fflush(stdin);

      c = getchar();

        string[i++] = c;

    } while (c != ' ');

    string[i - 1] = '';

    for (i = 0; i < strlen(string); i++)

    {

        while (i < strlen(string) && !isspace(string[i]) && isalnum(string[i]))

        {

            word[j++] = string[i++];

        }

        if (j != 0)

        {

            word[j] = '';

            if (!flag)

            {

                flag = !flag;

                strcpy(max, word);

                strcpy(min, word);

            }

            if (strlen(word) > strlen(max))

            {

                strcpy(max, word);

            }

            if (strlen(word) < strlen(min))

            {

                strcpy(min, word);

            }

            j = 0;

        }

    }

    printf("The largest word is '%s' and smallest word is '%s' in '%s'. ", max, min, string);

    return 0;

}

Accept 2 String and display common chars in them.

#include <stdio.h>
#include <conio.h>
#include<string.h>


void main()
{
char a[80],b[80];
int i,j,t;
clrscr();
printf("Enter 1st string ");
gets(a);
fflush(stdin);
printf("Enter 2nd string ");
gets(b);
printf("Common characters are : ");
for(i=0;a[i]!='';i++)
{
for(j=i-1;j>=0;j--)

   if(a[i]==a[j])
   break;
   if(j==-1)
   for(t=0;b[t]!='';t++)

     if(a[i]==b[t])
    {
     printf("%c",a[i]);
     break;
    }
}

getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote