Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/test/example/prg_exec_example.cpp @ 20

Last change on this file since 20 was 12, checked in by landauf, 17 years ago

added boost

File size: 568 bytes
Line 
1//  (C) Copyright Gennadiy Rozental 2001-2005.
2//  Distributed under the Boost Software License, Version 1.0.
3//  (See accompanying file LICENSE_1_0.txt or copy at
4//  http://www.boost.org/LICENSE_1_0.txt)
5
6//  See http://www.boost.org/libs/test for the library home page.
7
8int add( int i, int j ) { return i+j; }
9
10int cpp_main( int, char *[] )  // note the name!
11{ 
12    // two ways to detect and report the same error:
13    if ( add(2,2) != 4 ) throw "Oops..."; // #1 throws on error
14
15    return add(2,2) == 4 ? 15 : 1;         // #2 returns error directly
16}
17
18// EOF
Note: See TracBrowser for help on using the repository browser.