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

📄 chapter2-8.cpp

📁 C++STL程序员开发指南
💻 CPP
字号:
//文件名:CHAPTER2-8.cpp
#include<iostream.h>
#include<string.h>
class  Student
{
	friend  ostream& operator<<(ostream& ot, Student& popup);
	char  name[10];
	unsigned  int age;
	unsigned  long num;
public:
    Student(char *na, unsigned int al, unsigned long number):
     age(al), num(number)
	{
		 strcpy(name, na);
	 }
};
ostream&  operator<<(ostream& ot, Student& popup)
{
	      ot<<"Name"<<popup.name<<endl<<"Age"<<popup.age<<endl<<"Number:"
<<popup.num<<endl<<"------------------------"<<endl;
	 return ot;
}
void  main()
{
	    Student  a("Wang",18,1234),b("Zhao",19,4321),c("Liu",20,2134);
	    cout<<a<<b<<c;
}

⌨️ 快捷键说明

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