Need help with my C Programming question – I’m studying for my class.
it is c++ course and there are three labs. You can use visual studio programme.
Lab Assignment 17 – String Functions
NOTE: Before you write the program, write the program name, your name and the algorithm in pseudocode in the comments at the top of each function in your program, including main().
Write a new program called Lab17A that will read a string and perform string operations on it.
Create a string function named backwards that will accept a string variable as a parameter and return the backwards version of that string. (ex – Hello olleH)
Create a void function named separate that will accept a string variable as a parameter and will then print each word of the string on a separate line. (The words will be separated by spaces.)
In the main function do the following:
Ask the user to input a sentence, and read it (using getline)
Print the string itself and its length.
Call backwards sending the string variable as a parameter and print the return value.
Call separate sending the string variable as a parameter.
Make sure to include labels for everything printed.
Write a program named Lab17B that will read 2 strings and compare them.
Create a bool function named compareLetters that will accept 2 string variables as parameters and will return true if the strings have the same first letters and the same last letters. It will return a false otherwise.
Create a bool function named inside that will accept the 2 string variables (in the order they were entered) and will return a true if the first string has the second string inside it. (Ex – coldest & old would return a true because old is contained in coldest.) It will return a false otherwise.
In your main function:
ask the user to enter 2 strings on separate lines,
call the two functions with them
print the results with labels
Write a program named Lab17C that will count the number of words and vowels in a sentence.
Create a bool function called isVowel that accepts a character as a parameter and returns a true if it’s a vowel (aeiou) and false otherwise.
Create an int function named countVowels that will accept a string variable as a parameter and will return the number of vowels in it. Call the isVowel function as part of this process.
Write an int function named countWords that will accept a string variable as a parameter and will return the number of words in it. (Assume that there is only one space between each pair of words, and that the only spaces are between words.)
(To help with the logic, look at a sentence. Count the number of spaces in it and then count then number words. How are the two related?)
In your main function:
read a sentence from user using the getline command because the string should include spaces.
call the countVowels function with that string and print the returned value with a label
call the countWords function with that string and print the returned value with a label