高级语言程序设计(c++i)练习题(1).pdfVIP

  • 2
  • 0
  • 约2.3千字
  • 约 2页
  • 2021-05-26 发布于湖南
  • 举报
第 11 章 异常处理 11.1 阅读下列程序,写出执行结果 1.#include iostream.h int a[ 10 ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int fun( int i ); void main() { int i ,s = 0; for( i = 0; i = 10; i++ ) { try { s = s + fun( i ) ; } catch( int ) { cout 数组下标越界! endl; } } cout s = s endl; } int fun( int i ) { if ( i = 10 ) throw i ; return a[i] ; }

文档评论(0)

1亿VIP精品文档

相关文档