Write a program that defines the following strings: Char S1[100], S2[(20],S3[100]; Read the strings S1 and S2 from keyboard, initialize S3 with NULL then ask the user to choose a task from the following list: 1- Determine if S2 is a substring of S1. 2- Copy S2 to S3. 3- Determine if S2 is palindrome. 4- Count the number of vowels in S1. 5- Find the length of the string S1. 6- Display all the strings on screen. 7- Exit. Your program keeps on displaying the above list to the user and pert required task until the user enters 7. ms the Notes: 1- If S1="HelloWorld" and S2 = "World", then S2 is a substring of S1. 2- If S2="Hello", and the user chooses (2), the result is: S2="Hello", S3="Hello" 3- Palindrome means that it can be read from both ends as the same string. Example: Palindrome strings: ATTA, rar, SO, tttt The following strings are not palindrome: abab, abta, abc 4- The vowels are: a, e, o, u, i. If S1= abc, the number of vowels=D1 If S1= fcb, the number of vowels=0 If S1=Hello, the number of vowels=2

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

c++ language, please solve the question

Write a program that defines the following strings:
Char S1[100], S2[20],S3[100];
Read the strings S1 and S2 from keyboard, initialize S3 with NULL then ask the
user to choose a task from the following list:
1- Determine if S2 is a substring of S1.
2- Copy S2 to S3.
3- Determine if S2 is palindrome.
4- Count the number of vowels in S1.
5- Find the length of the string S1.
6- Display all the strings on screen.
7- Exit.
Your program keeps on displaying the above list to the user and performs the
required task until the user enters 7.
Notes:
1- If S1="HelloWorld" and S2 = "World", then S2 is a substring of S1.
2- If S2="Hello", and the user chooses (2), the result is:
S2="Hello", S3="Hello"
3- Palindrome means that it can be read from both ends as the same string.
Example:
Palindrome strings: ATTA, rar, SOS, tttt
The following strings are not palindrome: abab, abta, abc
4- The vowels are: a, e, o, u, i.
If S1= abc, the number of vowels=1
If S1= fcb, the number of vowels3D0
If S1=Hello, the number of vowels=2
1
Transcribed Image Text:Write a program that defines the following strings: Char S1[100], S2[20],S3[100]; Read the strings S1 and S2 from keyboard, initialize S3 with NULL then ask the user to choose a task from the following list: 1- Determine if S2 is a substring of S1. 2- Copy S2 to S3. 3- Determine if S2 is palindrome. 4- Count the number of vowels in S1. 5- Find the length of the string S1. 6- Display all the strings on screen. 7- Exit. Your program keeps on displaying the above list to the user and performs the required task until the user enters 7. Notes: 1- If S1="HelloWorld" and S2 = "World", then S2 is a substring of S1. 2- If S2="Hello", and the user chooses (2), the result is: S2="Hello", S3="Hello" 3- Palindrome means that it can be read from both ends as the same string. Example: Palindrome strings: ATTA, rar, SOS, tttt The following strings are not palindrome: abab, abta, abc 4- The vowels are: a, e, o, u, i. If S1= abc, the number of vowels=1 If S1= fcb, the number of vowels3D0 If S1=Hello, the number of vowels=2 1
5- If S1="Hello", the length of S1 = 5
6- Before displaying any string, check if it is empty (NULL) or not.
Example:
S1="Hello"
S2= "abc"
S3=""
If the user chooses 6, the following appears on screen:
S1= Hello
S2= abc
S3 is an empty string.
Transcribed Image Text:5- If S1="Hello", the length of S1 = 5 6- Before displaying any string, check if it is empty (NULL) or not. Example: S1="Hello" S2= "abc" S3="" If the user chooses 6, the following appears on screen: S1= Hello S2= abc S3 is an empty string.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT