answersLogoWhite

0

What is meant by throw command in c plus plus?

Updated: 10/24/2022
User Avatar

ArchanaNarayanan

Lvl 1
13y ago

Best Answer

A 'throw' statement throws an exception when it is generated within a try block. The exception is then caught by the corresponding catch block. For example,

void somefn()

{

float m, n;

try

{

cin>>m>>n;

if (n == 0)

throw(n);

else

cout<<(m/n);

}

catch (float x)

{

cout<<"Division by zero not possible";

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is meant by throw command in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is meant by println in c plus plus?

println is not a C++ keyword.


How can save output of c programs throw command?

C does not support try, catch, and throw. In C++, you can save the output to a file, or to some memory structure that would be displayed in a catch block.


Why c plus plus language is called command oriented language?

C++ is not a command oriented language, it is a multi-paradigm language because it employs functional and object-oriented approaches to programming.


How can you view page by page output in c plus plus?

Pipe the output to the MORE command.


What command is the control key plus c?

Copy the selected text (or object).


What is default name of c plus plus?

If you mean the original name of C++, it was originally called "C with Classes". However, after the introduction of template metaprogramming, it was renamed C++ which meant "the successor to C".


What are the combinations such as alt plus f4 and ctrl plus c called?

They are called accelerators. They are shortcut keystrokes that bypass the command menu system and call the associated command directly.


What command is used to destroy object in c plus plus?

You use delete object in C++ to delete an object. You can also implicitly delete the object, if it is automatic type, by going out of local scope.


How do you get to the g plus plus compiler once it is installed on ubuntu?

The C++ compiler is invoked with g++, however on many systems it is installed as c++. Consult the documentation for information on the command line options.


When do we use int in c plus plus programming?

'int' is one of the built-in data-types, it is meant to hold integer values.


What is meant by the term cint?

CINT is a command line in C/C++ interpreters that is presented in the package ROOT. CINT can be used as a standalone despite being included in the ROOT package.


What is meant by white spaces in c plus plus?

space, tabs (horizontal and vertical), carriage return, line feed, form feed.