Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ 1. Write a program to read in a character, an integer, and a float, and print out the values, then cast to other types;

C++

1. Write a program to read in a character, an integer, and a float, and print out the values, then cast to other types; so that the interaction with the user is something like the following:

 Input a single character, followed by : h Input an integer, followed by : 4872 Input a float, followed by : 182.937 The character h when cast to an int gives value ????? The character h when cast to a float gives value ????? The integer 4872 when cast to a char gives value ? The integer 4872 when cast to a float gives value ????? The float 182.937 when cast to a char gives value ? The float 182.937 when cast to an int gives value ????? 

2. Write a program with a recursive function, which calls itself to a certain call depth, e.g 10, and then throws an exception. The function shall as argument have the call depth when the exception is to be thrown. Let main() catch the exception and print at which call depth the exception was thrown. The call depth when the exception is to be thrown shall be given on the command line when the program is started. A run can look as follows, if the name of the program is throwup: %unix throwup 10 exception thrown at call depth 10.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions