CSDN专家博客精华版

为人民服务!
  首页  :: 新随笔  :: 管理
上一页 1 ··· 337 338 339 340 341 342 343 344 345 ··· 521 下一页

2007年12月17日

摘要: #include "stdafx.h"#include#include#includeusing namespace std;//从键盘上读取字符的函数void read_save(){ char c[80]; ofstream outfile("f1.dat"); //以输出方工打开文件 if(!outfile){ cerr=65&&c[i]=97&&c[i]=97) ch... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(341) 评论(0) 推荐(0)

摘要: #include "stdafx.h"#include#includeusing namespace std;class student{private: int num; int age; float score;public: student(int ,int ,float); void display();};//定义构造函数 student::student(int n,int a,f... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(108) 评论(0) 推荐(0)

摘要: ①//类型兼容规则举例#include "stdafx.h"#include using namespace std;class B0//基类B0声明{public: void display(){coutdisplay();//"对象指针->成员名"}void main()//主函数{ B0 b0;//声明基类B0类对象 B1 b1;//声明B1类对象 D1 d1;//声明D1类对象 B0 ... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(165) 评论(0) 推荐(0)

摘要: #include "stdafx.h"#include#includeusing namespace std;class person{//声明基类 protected: int age; char sex; string name;public: person(int a,char s,string nam){ age=a; sex=s; name=nam; }};class teac... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(118) 评论(0) 推荐(0)

摘要: 这几天写的程序应用到多继承。以前对多继承的概念非常清晰,可是很久没用就有点模糊了。重新研究一下,“刷新”下记忆。 假设我们有下面的代码: #include class A { private: char data; public: A(){data = 'A';} virtual void Show(){printf("A\n");}; virtual void Di... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(65) 评论(0) 推荐(0)

摘要: 构造函数、析构函数与赋值函数是每个类最基本的函数。它们太普通以致让人容易麻痹大意,其实这些貌似简单的函数就象没有顶盖的下水道那样危险。 每个类只有一个析构函数和一个赋值函数,但可以有多个构造函数(包含一个拷贝构造函数,其它的称为普通构造函数)。对于任意一个类A,如果不想编写上述函数,C++编译器将自动为A产生四个缺省的函数,如 A(void); ... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(121) 评论(0) 推荐(0)

摘要: 原文地址:http://www.myplaces.com.cn/index.php/action/viewspace/itemid/21751看下面的例子:test.c#includemain(){ char *str="I like Linux! I advices you jion in the Linux World"; printf("%s\n",str); exit(0... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(106) 评论(0) 推荐(0)

摘要: cygwin/gcc和MinGW都是gcc在windows下的编译环境,但是它们有什么区别?在实际工作中如何选择这两种编译器呢? cygwin/gcc完全可以和在linux下的gcc划等号,这个从boost库的划分中就可以看出来端倪,cygwin下的gcc和linux下的gcc使用的是相同的Toolsets。 所以完全可以和linux一起同步更新gc... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(214) 评论(0) 推荐(0)

摘要: gcc和g++都是GNU(组织)的一个编译器。误区一:gcc只能编译c代码,g++只能编译c++代码两者都可以,但是请注意:1,后缀为.c的,gcc把它当作是C程序,而g++当作是c++程序;后缀为.cpp的,两者都会认为是c++程序,注意,虽然c++是c的超集,但是两者对语法的要求是有区别的。C++的语法规则更加严谨一些。2,编译阶段,g++会调用gcc,对于c++代码,两者是等价的,但是因... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(94) 评论(0) 推荐(0)

摘要: 在Symbian程序中我们经常会看到IMPORT_C这个关键字,它是C:\Symbian\8.0a\S60_2nd_FP2_SC\epoc32\include下e32def.h文件里面定义的一个宏. 原定义如下:#define IMPORT_C __declspec(dllexport)那么__declspec(dllexport)又是什么东东呢?先看代码:以下是在dev-c+... 阅读全文

posted @ 2007-12-17 10:30 csdnexpert 阅读(97) 评论(0) 推荐(0)

上一页 1 ··· 337 338 339 340 341 342 343 344 345 ··· 521 下一页