C++学习起步
来源:互联网 发布:mac放电影有杂音 编辑:程序博客网 时间:2024/05/17 21:38
//
// main.cpp
// C++(1)
//
// Created by mac on 15-2-15.
// Copyright (c) 2015年 xutao. All rights reserved.
//
#include <iostream>//作用是将文件iostream的内容包含到该命令所在的程序文件中,代替该命令行。iostream是输出流的意思。
//int main(int argc, const char * argv[]) {
// // insert code here...
// std::cout << "Hello, World!\n";
// return 0;
//}
//c++标准库的类和函数是在命名空间中std中声明的,因此如果需要用到c++标准库中信息时,就需要using namespace std,表示要用到命名空间std中得内容
/*
using namespace std;//使用空间命名std
int main()
{
// cout 是输出流对象
<<是插入运算符,与cout配合使用,在本例中将运算符“”这里面的语句插入到输出的队列cout中
cout<<"This My First C++ Programm";
return 0;
}
*/
/*
//求a,b两个数的和
using namespace std;
int main()
{
int a,b,sum;
cin >>a>>b;
sum=a+b;
cout<<"a+b="<<sum<<endl;
}
*/
/*
//求两个数中得最大者
using namespace std;
int main()
{
int x,y,m;
cin>>x>>y;
m=max(x,y);
cout<<"max="<<m<<endl;
return 0;
}
int max(int x,int y)
{
int z;
if (x>z) {
z=x;
}else{
z=y;
}
return z;
}
*/
//包含类的C++程序
using namespace std;
class Student {
private:
int num;
int score;
public:
void setData(){
cin>>num;
cin>>score;
}
void display(){
cout<<"num="<<num<<endl;
cout<<"score="<<score<<endl;
}
};
Student stud1,stud2;
int main()
{
stud1.setData();
stud2.setData();
stud1.display();
stud2.display();
}
- 起步C语言学习....
- C起步
- linux下c编程起步学习:掌握gcc基本用法
- linux下c编程起步学习:掌握gcc基本用法
- 我的C语言学习历程:起步篇
- c语言起步
- C起步感想
- Ajax(.Net)学习起步
- [Appfuse学习] 起步
- 数据库学习起步
- XDoclet起步学习_1
- 学习WF起步
- 网络生活起步学习
- 起步:linux学习
- LoadRunner 学习的起步
- hibernate 起步学习
- flex学习起步
- shell 学习起步知识
- 程序性能优化探讨(6)——矩阵乘法优化之分块矩阵
- 谈谈微信红包海量运营--发10亿个红包难在哪里?
- CreateProcess的前两个参数究竟怎么用
- 线性回归概率解释(Linear Regression)
- SDUT 3145 Integer division 1
- C++学习起步
- pat1021 Deepest Root
- 【HDU 1512】Monkey King
- C语言操作Excel表格
- UVa 1614 - Hell on the Markets(贪心)
- iOS数据持久化方法
- JAVASE--GUI图形用户界面、网络编程
- Android 5.0中AudioPatch概念简单探索
- MacBook Pro光驱常年不用,光驱不吸盘,光盘塞不进去了。咋办?