Thread: throw exception in Try Block and catch

  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をこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

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-21-2010, 12:49 AM
  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, 10: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