hello c++ demo c++基本语法
来源:互联网 发布:程序员考试难吗 编辑:程序博客网 时间:2024/06/11 14:06
hello c++ demo c++基本语法
#include <iostream>/* run this program using the console pauser or add your own getch, system("pause") or input loop *//**是预处理指令,以#开头的指令将交给预处理器处理。<>指从标准位置查找头文件stdio.h(因为下面要用到printf函数,所以要先拷贝该文件,它包含了printf函数)**/#include<stdio.h>#include<stdlib.h>using namespace std;int main(void) {int x=100;cout<<x<<endl<<x; printf("hello c++");return 0;}
#include <iostream>/* run this program using the console pauser or add your own getch, system("pause") or input loop *//**是预处理指令,以#开头的指令将交给预处理器处理。<>指从标准位置查找头文件stdio.h(因为下面要用到printf函数,所以要先拷贝该文件,它包含了printf函数)**/#include<stdio.h>#include<stdlib.h>using namespace std;int main(void) { cout<<"请输入一个整数"<<endl; int x=0; cin>> x; cout<<oct<<x<<endl; //八进制 cout<<dec<<x<<endl; //十进制 cout<<hex<<x<<endl; //十六主进制 cout<<"请输入一个布尔值(0,1):"<<endl; bool y=false; cin>>y; cout<<boolalpha<<y<<endl; system("pause"); return 0;}
#include<iostream>#include<stdio.h>#include<stdlib.h>using namespace std;//namespace 的应用 ::namespace A{int x=1;void fun(){cout<<"A"<<endl;}}namespace B{int bx=2;void fun(){cout<<"B"<<endl;}}using namespace B;int main(void){cout<<A::x<<endl; //::引用 namespaceB::fun(); //::引用 namespacecout<<bx<<endl; //using 引用 namespacesystem("pause");return 0;}
1 0
- hello c++ demo c++基本语法
- C语言基本语法
- Object-c基本语法
- Objective-c基本语法
- Objective C基本语法
- Objective-C基本语法
- C 基本语法
- C#-基本语法
- C 基本语法
- 【C#】 基本语法
- C 语言基本语法示例
- 第一章.Object-c基本语法
- Objective-C基本语法简介
- C语言学习-基本语法
- C语言基本语法总结
- Objective-C的基本语法
- 1.Objective-C基本语法
- Objective-C基础 (基本语法)
- 2016网易游戏开发校招题目——Best Compression Algorithms
- 内联函数,重载函数,默认参数
- Android--listview的item侧滑的实现
- Android应用进程间通信之Messenger信使使用及源码浅析
- Linux 终端自动安装orical java8 和 Android studio
- hello c++ demo c++基本语法
- 熟悉oc面向对象的小例子
- Big Number
- 堆排序算法
- window.print() web打印的一些技巧
- Handler详解之一
- SQL Network Interfaces, error: 50 - 发生了 Local Database Runtime 错误。无法创建自动实例
- Redis与Memcached的区别
- Guava(二):重写的那些Object方法