Create a variable containing a one row character array containing ‘some letters’. Do this using square brackets and individual characters. Use class to confirm the type of the variable.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

A. Create a variable containing a one row character array containing ‘some letters’. Do this using square brackets and individual characters. Use class to confirm the type of the variable.
B. Repeat the last part but create the string variable using a single set of single quotes.
C. Make a two row character array containing ‘some’ and ‘letters’ on separate rows. What do we need to do to make sure these two words can be fitted into a two row array?
D. Make an explicit conversion of the character array from the last part to a numeric type.
E. What happens if we try to make an explicit conversion of the character array of the last part to a logical type?
F. Make an implicit conversion of the character array to a numeric type.
G. For each of the following string, try and generate a corresponding numeric value using the str2double function. Give the reason why some of these conversions can fail and how we can test for it.
‘-4’
‘j’
‘2.5’
‘X.9’
‘3.7e+04’

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning