throw exception in Try Block and catch

This is a discussion on throw exception in Try Block and catch within the C++ Programming forums, part of the General Programming Boards category; Code: using namespace System; int main() { SByte Age = 224; Console::WriteLine(Age); return 0; } in this code if I ...

  1. #1
    Registered User mirshany's Avatar
    Join Date
    Apr 2011
    Location
    China
    Posts
    3

    throw exception in Try Block and catch

    Code:
    using namespace System;
    
    int main()
    {
    	SByte Age = 224;
    
    	Console::WriteLine(Age);
    
    	return 0;
    }
    in this code if I give the value of Age>=224 the result will be false according the data typey , so how I write this code in Try catch exception handling if value is greater,it throws exception give message its out of bound
    else show the number

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,587
    This is not C++. This is Managed C++/(C++/CLI). It would be better to post this in Techboard in the future.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User mirshany's Avatar
    Join Date
    Apr 2011
    Location
    China
    Posts
    3
    thanks
    for guidance Elysia

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,531
    Posted here -> Try Catch Block
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. try catch throw in c++
    By lowchernhwee in forum C++ Programming
    Replies: 5
    Last Post: 12-20-2010, 11:49 PM
  2. try-catch-throw
    By TriKri in forum C++ Programming
    Replies: 4
    Last Post: 07-05-2007, 12:55 AM
  3. Try...catch...throw or ifs?
    By Kylecito in forum C++ Programming
    Replies: 9
    Last Post: 03-02-2006, 09:41 PM
  4. Exception Handling, How? Try/Catch throw...
    By chadsxe in forum C++ Programming
    Replies: 16
    Last Post: 07-19-2005, 07:57 PM
  5. try catch throw
    By ygfperson in forum C++ Programming
    Replies: 2
    Last Post: 07-27-2003, 02:15 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21