2.1 一个简单的函数

函数又叫方法,即实现某项功能或服务的代码块

void show(){
    std::cout << "hello world!";
}

例子如下:

#include<iostream>
void show(){
    std::cout << "Hello World!" << std::endl;
}
int main(){
    show();
    return 0;
}

 

posted @ 2015-05-14 13:08  cppstudy  阅读(125)  评论(0编辑  收藏  举报