C++入门 输出Hello World
#include <iostream>using namespace std;int main(){
cout << "Hello, world!" << endl; return 0;}它等效于
#include <iostream>using namespace std;int main(){
cout << "Hello, world! \n"; return 0;}#include <iostream>using namespace std;int main(){
cout << "Hello, world!" << endl; return 0;}它等效于
#include <iostream>using namespace std;int main(){
cout << "Hello, world! \n"; return 0;}什么是注释呢?这简直是废话,就像您在读书时候做的笔记,复习的时候圈的重点,简单来说,它并不是程序的一部分,但是它可以进行解释程序的行为或者任何想加在程序里面的东西。它的格式就两种,第一种/* 我是注释 我还是注释 &nb...
变量是什么?变量就是可以储存值的量,分为局部变量和全局变量,等用到了再说!变量有什么类型?1、int类型 整数类型,只能用来保存整数2、long类型 长整数类型,只能用来保存整数,但是保存的数的范围更多3、float类型 浮点数类型,绝大多数,带小数的4、double类型 双精度浮点数类型,绝大多数...
#include <iostream> using namespace std; int addnum(int a,int b) { return a+b; } int ...
什么是数组呢?顾名思义,一组数,不一定是数,也可以是char类型的字符组(我自己给char类型数组起的名字)怎么创建数组呢?int 数组名[数组成员数]; int a[3];我就创建了一个叫做a的整数数组,数组中包含3个数,我应该怎么修改a数组的值呢?a[0]=1; a[1]...
#include<iostream> using namespace std; int main() { cout << "The size of int is&nb...
#include<iostream> void print(); int main() { char a=0; for(a=0;a<20;a++) print(); return 0; } v...