在函数体的“入口处”,对参数的有效性进行检查

在函数体的“入口处”,对参数的有效性进行检查。

 

 1 #include <iostream>
 2 #include <stdlib.h>
 3 #include <math.h>
 4 using namespace std;
 5 //main()函数的定义
 6 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 7 
 8 int main(int argc, char** argv) {
 9        double y;
10     for(int i=0;i<=10;i++){
11         y=sqrt(i);
12         cout<<"sqrt("<<i<<")="<<y<<endl;
13     }
14     return 0;
15 }

 

posted @ 2018-08-03 13:15  borter  阅读(253)  评论(0编辑  收藏  举报