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

 

 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 }

 

相关文章:

  • 2022-12-23
  • 2022-01-16
  • 2021-09-22
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-01-20
  • 2021-11-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案