⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter4-17.cpp

📁 C++STL程序员开发指南
💻 CPP
字号:
//文件夹名称:CHAPTER4-17.cpp
#include<iostream.h>
#include<afx.h>
#include<afxcoll.h>
#define NUMBER 5
class A:public CObject
{
	 int age;
public:
    A(int x):age(x){}
void operator!(){cout<<age<<endl;}
};
void main()
{
  int x=-1;
  CObList list;
  A *p[NUMBER];
  cout<<"Please input "<<NUMBER<<" integers"<<endl;
  for(int i=0;i<NUMBER;i++)
  {
    while(x<0)cin>>x;
	p[i]=new A(x);
	list.AddHead(p[i]);
	x=-1;
  }
  cout<<"The total number is "<<list.GetCount()<<endl;
  !*((A*)list.GetHead());
  if(list.Find(p[2]))!*p[2];
  !*((A*)list.GetAt(list.FindIndex(3)));
  cout<<flush;
  cin.get();
  list.RemoveAll();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -