您的位置:首页 > 理论基础 > 数据结构算法

零起点学C++ 第四章 C++数据结构

2016-07-08 17:35 309 查看
demo1:变量的定义

#include <iostream>

int add(int x,int y)

{
return x+y;

}

using namespace std;

int main()

{
int x=1,y=2;
cout<<add(x,y);
return 0;

}

demo2:将变量及数据存储在内存中

#include <iostream>

using namespace std;

int main()

{
int a=35;
cin>>a;
return 0;

}

demo3:布尔型变量

#include <iostream>

using namespace std;

int main()

{
bool check=true;
if (check==true)
{
cout<<"hello world\n";
}
return 0;

}

demo4:字符型比变量

#include <iostream>

using namespace std;

int main()

{
cout<<"特殊字符";
char ch='\r';
cout<<ch<<"特殊用途";
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: