Question
thumb_up100%

Transcribed Image Text:1. Write a program that will ask for 10 strings/strings of char and output the strings/strings of char in alphabetical order.
a. The program only uses the iostream header file and declares the strings as an array of characters
b. The program may use other header file and use the data type string.
2. Write a program that will ask for a long string (max of 100 characters), and a target string. The program must determine if the target string is present in the input long string.
3. Modify Number 2, the program must count the number of times the target string exists in the input long string.
4. Write a program that will ask for 10 strings and determine if the input strings are palindrome.
sample output:
hannah palindrome
george: not palindrome
After you check and run that the program executes correctly, you must submit a report that includes the source code for all the exercises that also includes the screenshot of the program execution.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 1 images

Knowledge Booster
Similar questions
- Using C++ Language Write a program to implement the following: • Declare two C-strings str1 and str2 of appropriate sizes. • Use strcpy() to copy the string “Hello World.” into str1 • Using a suitable message, read the user input into str2. The user may enter more than one word. • Determine and store the length of both char arrays using strlen() • Check if both char arrays are the same length using the stored lengths o If they are the same length, tell the user they are the same length o If they are not the same length, tell the user the strings are different and end the program using a return statement. • Compare both strings using strcmp to check if they are the same string. o If they are the same string, inform the user of this o If they are not the same string, inform the user of this o Note that you compare only if they are of the same length, hence the return statement in the earlier step.arrow_forwardc++ problem. paste indented code Given the code:string s;cout << "Enter a string of any length: ";cin >> s; Write a loop to print every other character in the string s on its own line. Note that s can be a string of any length.Example Output 1Enter a string of any length: HelloHloExample Output 2Enter a string of any length: GoodbyeGobearrow_forwardQ1 Which of the following statements is true if x (a character array) is added (+) to a y (2 x 2 double)? Select one: a. Variable x will be converted into a double and then concatenated with y to create new ASCII-type variable b. The addition operation (+) cannot be performed c. Variable y will be converted into a string and then concatenated with x to create a new string-type variable d. ASCII values of x are added to y to create a new double-type variable e. It is equivalent to the statement x == y and creates a logical-type variable Q2 Consider the following non-linear equation where x is the independent variable, y is the dependent variable, and A and B are constants. Which of the following is the resulting gradient variable in linearised form? Select one: a. B b. log10(B) c. log(-A) d. A e. exp(B) Q3 Which of the following statements is false for the function header below? function [cat, ox, dragon] = rat(pig, snake) Select one:…arrow_forward
- a. Create a 1D array of integers to store 50 integers. b. Store values from 0 to 49 into the array you just created. c. Create a new String Object using no-arg constructor. d. Using for loop append the array elements one by one to the String (one per loop iteration) e. Record and display a run-time it took to append all integers to the String (record run-time of 1.d.)). E.g. "It took nanoseconds to append 50 integers to the Stringarrow_forwardC++ Complete this by using string streams Create a program that reads a simple arithmetic expression and evaluates it. More precisely, the program reads from the user a line of text that’s supposed to contain two numbers separated by an arithmetic operator, as in35.6 + 12The program then prints back the expression and its value, as in35.6 + 12 = 47.6The program should verify that the input line contains two numbers, oneoperator and nothing else. There can be whitespace before the first number, after the second number and between each number and the operator.The operator can be either +, −, * or /. In case of an error, the program should print "Invalid expression" and quit. When the program prints the expression, there should be no whitespace before the first number and there should be exactly one blank space before and after the operator and the equal sign.Use string streamsarrow_forwardWrite a program that lets the user enter the total rainfall for each of 12 months into a vector of doubles. The program will also have a vector of 12 strings to hold the names of the months. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts. Part 1 Write main(). In main do the following:(a) Declare a vector of doubles and a vector of strings.Suggested variable name for vector of doubles is rainfall. Suggested variable name for vector of strings is monthNames(b) Store the months in your string vector in the following order: January, February, March, April, May, June, July, August, September, October, November, December. Make sure you write out the month names fully (do not use abbreviations).(c) Get input for 12 doubles from the user to place into the vector of doubles. Each double will be the amount of rain for the month parallel to the string vector of month names.(d) Display the…arrow_forward
- 1. Write a program that reads two strings from the keyboard using a while loop A.Terminate the loop when both strings have the same content, done B.Display both strings if the contents are different C.For strings with the same contents, display if they are at the same address 2.Demonstrate a situation in which the JVM will use garbage collection 3.Given the following strings: Middlesex CollegeDemonstrate the use of the following String methodsconcat(), length(), trim(), charAt(), both substring()arrow_forwardDeclare a two-dimensional char array that is 25 by 25 that represents the entire ocean and an If statement that prints “HIT” if a torpedo hits a ship given the coordinates X and Y. Write a C++ program that will read in a file representing a game board with 25 lines where each line has 25 characters corresponding to the description above. An example file might look like: ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~#####~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~#~~~~~~~~~~ ~~~~~~~~~~~~~~#~~~~~~~~~~ ~~~~~~~~~~~~~~#~~~~~~~~~~ ~~~~~~~~~~~~~~#~~~~~~~~~~ ~~~~~~~~~~~~~~#~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~#####~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ ~######~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~#####~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~#~~~~~ ~~~~~~~~~~~~~~~~~~~#~~~~~ ~~~~~~~~~~~~~~~~~~~#~~~~~ ~~~~~~~~~~~~~~~~~~~#~~~~~ ~~~######~~~~~~~~~~#~~~~~…arrow_forward20arrow_forward
arrow_back_ios
arrow_forward_ios