zoukankan      html  css  js  c++  java
  • 在每个类声明之后、每个函数定义结束之后都要加空行。

    在每个类声明之后、每个函数定义结束之后都要加空行。

     1 #include <iostream>
     2 
     3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
     4 using namespace std;
     5 //函数原型语句
     6 int  abs(int x);
     7 long abs(long x);
     8 float abs(float x);
     9 
    10 //main()函数的定义
    11 int main(int argc, char** argv) {
    12     //声明变量
    13     int i1=32767,i2=-32767;
    14     long l1=456789,l2=-456789;
    15     float x1=1.1234,x2=-1.1234;
    16    
    17     //直接在cout输出中调用函数
    18     cout<<abs(i1)<<","<<abs(i2)<<endl;
    19     cout<<abs(l1)<<","<<abs(l2)<<endl;
    20     cout<<abs(x1)<<","<<abs(x2)<<endl;
    21     return 0;
    22 }
    23 
    24 
    25 //定义int型的abs()函数
    26 int abs(int x) {
    27     if (x<0)
    28        return(-x);
    29     else
    30        return(x);
    31 }
    32 
    33 //定义long型的abs()函数 
    34 long abs(long x) {
    35     if (x<0)
    36        return(-x);
    37     else
    38         return(x);
    39 }
    40 
    41 //定义float型 abs函数
    42 float abs(float x) {
    43     if (x<0.0)
    44        return(-x);
    45     else
    46        return(x);
    47 }
  • 相关阅读:
    metasploit--multi/samba/usermap_script
    msfcli 不能使用,在新版metasploit不再有效,推荐使用msfconsole
    test.fire渗透测试
    metasploit服务扫描与查点
    Synchronized底层实现
    正在使用的IDEA插件
    JavaWeb
    设计模式
    MySQL
    计算机网络
  • 原文地址:https://www.cnblogs.com/borter/p/9412947.html
Copyright © 2011-2022 走看看