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

Introduction In this assignment you will write a small C program. Your program s

ID: 3601763 • Letter: I

Question

Introduction In this assignment you will write a small C program. Your program should compile correctly and produce the specified output. Please note that the computer program should comply with the commenting and formatting rules as has been done in class. For cxample, there should be a header for the whole program that gives the author's name, class name, date, and description. End braces should be commented, and there are alignmet and indenting roquirements as discussed. Please ask if you have any questioms m #1 Write a program to display the folkowing menu I) Enter string 2) String length 3) Count characters case sensitive 4) Count characters non case sensitive 5) Exit. The program should determine if option I was enterod, before the user selocts any of the other optioes (2-4). If user sclect a number from 2-4, a function should be called. All these functions should receive at least one parameter. Option 3 and 4 must return an inteper value (representing the number of different characters in the o-stringh, and display a table as shown below, Option will finish the program The string cenmot be hard coded. A menu should be displayed (failing to display the mena will translate to 0 as homework grade) Given a string char strn(i.e. stri- "Programming Assignment") A) (10 points) Write a rwrsive function to find the length of the string (option 2). B) (40 points) Write a ecrsive function that returns how many diffierenotincading repeated entries) characters (case sensitive) are in the string (ie, T is mot the same as' Using this function display a table to indicate the namber of different characters, and the number of times each character appears in the string, for example CS1325 Introduction to Programming Page: 2 Output Character Number of Times Total: 13 C)

Explanation / Answer

Below is the Whole program as per menu you have shown if any doubt please tell reply:

#include<stdio.h>


int length(char str[]);


int length( char s[])
{
if(*s == '')
return 0;
return 1 + length(s + 1);
}


int main()
{

char str[100];
int ptr=0;
int size;
int choice;
int c=0;
int count[26]={0};
int i;

menu :

{printf("Enter listed number for operation ");
printf("1)Enter String 2)String Length 3)Count Characters case sensitive 4)Count Characters non case sensitive 5)Exit ");
scanf("%i",&choice);
}
switch(choice)
{

case 1:


printf("Enter String ");
scanf("%s",&str);

goto menu;

case 2:


printf("length is=%i ",length(str));
ptr=length(str);

goto menu;


case 4:


for(i=0; i<ptr; i++)
{
  
if(str[i]>='a' && str[i]<='z')
{
count[str[i] - 97]++;
}
else if(str[i]>='A' && str[i]<='Z')
{
count[str[i] - 65]++;
}
}

  
printf(" Ocurrence of give characters in array is: ");
for(i=0; i<26; i++)
{
  
if(count[i] != 0)
{
printf("'%c' = %d ", (i + 97), count[i]);
}
}

goto menu;

case 5:
break;


}

return 0;


}

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