C++捷径之三
来源:互联网 发布:淘宝联盟二合一口令 编辑:程序博客网 时间:2024/04/30 06:52
P108 4.9
struct inv_type{
char item[40];
double cost;
double retail;
int on_hand;
int lead_time;
} invtry[SIZE]; //使用数组结构
for(t=0; t<SIZE; t++)
*invtry[t].item='/0'; //初始化item数组
//系统时间
#include <iostream>
#include <ctime>//时间库文件
using namespace std;
int main()
{
struct tm *ptr;//tm结构指针
time_t lt;//time_t类型
lt=time('/0');//初始化
ptr=localtime(<);
cout<<ptr->tm_hour<<':'<<ptr->tm_min;
cout<<':'<<ptr->tm_sec;//
cout<<asctime(ptr);//
cout<<endl;
return 0;
}
//对于引用,函数的传递,还需更深的理解。
//按位显示U
void disp_binary(unsigned u)
{
register int t;
for(t=128; t>0; t=t/2)
if( u&t)
cout<<"1 ";
else
cout<<"0 ";
}
union{
short int count;
char ch[2];
};
ch[0]='X';
ch[1]='Y';
cout<<count<<endl;// 匿名联合
//对类,在定义一个类的对象时,自动调用类的构造函数,在退出时,自动调用析构函数
//类的几种初始化方法。
class myclass{
int a;
public:
myclass(int x);
int get_a();
};
myclass::myclass(int x)
{ a=x; }
int myclass::get_a()
{ return a; }
int main()
{
myclass ob=4;//?????不是很明白
myclass oc(444);
myclass od=myclass(4444);//这个也不明白
return 0;
}
- C++捷径之三
- c/c++成长之捷径
- c/c++成长之捷径
- c/c++成长之捷径
- c/c++成长之捷径 C/C++学习资料大全
- 通向DirectDraw之捷径
- C++捷径之二
- C++捷径之四
- C++捷径之五
- C++捷径之六
- 学好C语言的捷径
- C++捷径之七--结束
- 捷径
- 捷径
- 捷径
- 掌握ASP.NET技术之捷径
- 细读《Effective C++》之三
- 细读《Effective C++》之三
- 不作35岁的程序员
- 获得select内容而不是value值
- 最近要写 发短信的代码,哈哈一点心得,大家共享
- hibernate开发中的Date数据类型问题
- 批量附加、分离数据库
- C++捷径之三
- 全选与不全选的切换
- 忽然想写一些技术方面的东西
- 体验雅黑
- IE和Firefox在JavaScript方面的兼容性(汇编)
- 在eclipse更改CVS的服务器IP地址
- 调整双系统开机时选择启动的等待时间
- .Net 中通用的FormatString格式符整理
- C#中关键词ref的用途(传址参数需要修饰符ref)