zoukankan      html  css  js  c++  java
  • C++输出hello world 详细注释

    /* #include<iostream>
    	#:预处理标志,后面跟预处理指令,include:预处理指令,包含 <iostream>:c++头文件,输入输出流
    		这行的作用就是在预编译之前先执行这行代码。系统提供的头文件用<>括起来
       #include<iostream.h>
    		这个头文件是c标准的头文件,c++中叫非标准库文件。
       using namespace std;使用标准命名空间。也就是说C++当中的标准库文件,函数,对象啊等都存放在std空间中,
    		作用:作用是在编写大程序的时候能够定义重复的变量,(标识符)
    		当需要调用标准空间中的对象,函数的时候调用方法:std::cout std::cin std::endl;需要加双冒号
    	#include<iostream> #include<iostream.h>的区别:
    		使用#include<iostream>的时候,需要使用using namespace std;而#include<iostream.h>不需要
    */
    #include <iostream>
    //using std::cout;	//使用std空间中cout对象。::调用的意思
    //using std::endl;
    int main(void)
    {
    	//cout<<"hello world"<<endl;
    	std::cout<<"hello world"<<std::endl;
    	return 0;
    }
    
    /*
    #include<iostream>
    using namespace std;
    int main(void)
    {
    	cout<<"hello world"<<endl;
    	return 0;
    }
    
    
    #include<iostream.h>
      int main(void)
      {
    	cout<<"hello world"<<endl;
    	return 0;
      }
    */
    
    //重命名问题
    #include<iostream>
    namespace a
    {
        int b=5;
    }
    namespace c
    {
        int b=99;
    }
    int main(void)
    {
        int b=-77;
        std::cout<<b<<std::endl;
        std::cout<<a::b<<std::endl;
        std::cout<<c::b<<std::endl;
        return 0;
    }

      

  • 相关阅读:
    mysql的悲观锁与乐观锁的实现
    java中int和Integer的区别
    node 爬取图片并下载 到本地
    vue-cli3.0使用及配置(部分)
    vue模块组件
    新版公共弹出层
    四面八方拖拽
    js常用功能技巧函数
    localStorage和cookie的跨域解决方案
    前端面试要点
  • 原文地址:https://www.cnblogs.com/fengkui/p/6117914.html
Copyright © 2011-2022 走看看