C++代码
来源:互联网 发布:win7怎么关闭端口 编辑:程序博客网 时间:2024/05/17 08:25
//时钟类完整程序
/*
#include<iostream>
using namespace std;
class Clock
{
public:
void SetTime(int NewH=0,int NewM=0,int NewS=0);
void ShowTime();
private:
int Hour,Minute,Second;
};
//时钟类函数的具体实现
void Clock::SetTime(int NewH,int NewM,int NewS)
{
Hour=NewH;
Minute=NewM;
Second=NewS;
}
inline void Clock::ShowTime()
{
cout<<Hour<<":"<<Minute<<":"<<Second<<endl;
}
int main()
{
Clock myClock;
cout<<"First time set and output:"<<endl;
myClock.SetTime();
myClock.ShowTime();
cout<<"Second time set and output:"<<endl;
myClock.SetTime(8,30,30);
myClock.ShowTime();
cout<<"Third time set and output:"<<endl;
myClock.SetTime(9,30,30);
myClock.ShowTime();
}
*/
// 函数的参数传递-值调用
/*
#include<iostream>
using namespace std;
void Swap(int a,int b);
int main()
{
int x=5,int y=10;
cout<<"x="<<x<<" y="<<y<<endl;
Swap(x,y);//这里将实参5传递给形参x,将实参10传递给形参y.
cout<<"x="<<x<<" y="<<y<<endl;
}
void Swap(int a,int b)//形参发生变化不会影响实参
{
int t;
t=a;
a=b;
b=t;
}
*/
//函数的参数传递-引用调用
/*
#include<iostream>
using namespace std;
void Swap(int &a,int &b)
{
int t;
t=a;
a=b;
b=t;
}
int main()
{
void Swap(int &a,int &b);
int x=5,y=10;
cout<<"x="<<x<<" y="<<y<<endl;
Swap(x,y);
cout<<"x="<<x<<" y="<<y<<endl;
}
*/
/*
#include<iostream>
#include<iomanip>
using namespace std;
void fiddle(int in1,int &in2)
{
in1=in1+100;
in2=in2+100;
cout<<"The values are";
cout<<setw(5)<<in1;
cout<<setw(5)<<in2<<endl;
}
int main()
{
void fiddle(int in1,int &in2);
int count=7,index=12;
cout<<"The values are";
cout<<setw(5)<<count;
cout<<setw(5)<<index<<endl;
fiddle(count,index);//引用调用关键 int &int2=index=12
//index=112.
cout<<"The value are";
cout<<setw(5)<<count;
cout<<setw(5)<<index<<endl;
}
*/
万事开头难,才开始学习C++就把自己的编写的代码放在网上,慢慢学习了。
相信一天我也会从一个菜鸟变成一个老鸟。
- C++代码
- C++代码优化方法总结
- 用xcode编译c++代码
- android studio调试c++代码
- yacc&lex-调用C++代码
- Android ril原生代码(C/C++)和java代码部分分析
- 快速高效读C代码和读C++代码
- 【下载】Visual C++示例和代码 / Code Sample
- 光流法的介绍(含C++代码)
- 0-1背包问题回溯法C++代码
- 如何加快C++代码的编译速度
- 这十月,与C++代码相伴的日子。
- 终于看到真正的c++代码了。
- 光流法的介绍(含C++代码)
- 归并排序c++代码及详细注释
- 【poj 1182】 食物链 题解&代码(C++)
- 【poj 2352】Stars 题意&题解&代码(C++)
- 【poj 1182】 食物链 题解&代码(C++)
- 做对的事情,把事情做对——中创软件董事长景新海访谈
- Developer to Designer: GUI Design for the Busy Developer
- Effective C#之14:Utilize Constructor Chaining
- 常用Oracle数据库调优工具介绍[转]
- MIT Java Wordnet Interface初体验
- C++代码
- 初学者的迷茫
- PHP - XML - Creating XML
- JS: onfocus和onblur事件应用举例
- JAVA的几个常见错误简析
- PHP - Xml - Adding or Removing XML Nodes
- PSMLIB个人服务器管理组件,IIS管理组件,FTP管理组件
- .NET 2.0 中TextBox只读时在客户端赋值后的取值问题
- Javascript document.all用法