Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROBLEM 1 (a) Write a declaration to store the string This is a test in an array named char strtest [ 14 ] . Then
PROBLEM 1 (a) Write a declaration to store the string "This is a test" in an array named char strtest [ 14 ] . Then write a for statement to display the string in reverse order: tset a si sihT" (b) Write a while loop to display the string as stored. The expression while (str test [i] != ' \0' ) can be used. [5 points] 5 points] (c) Write a for statement to display only the array elements t, e, s, andt. 5 points] e) Define a vector of strings using the atrteat [) aray using the statement vector strvec (strtest, strtest+14) . Rewrite the C++ code fragment in part (a) above using vector class and functions specified in Table 7.2 of Bronson text. Include necessary libraries. You may use the vector functions: strvec.size, strvec.begin, strvec.end O, strvec.at (index), etc. [10 points]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started