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

📄 8-1.cpp

📁 为初学者提供的最佳的C++程序设计源程序库
💻 CPP
字号:
#include<iostream.h>
#include<string.h>
class phone
{
   char name[50];
   char tell[15];
public:
   void store(char *n,char *num);
   void print();
};
void phone::store(char *n,char *num)
{
  strcpy(name,n);
  strcpy(tell,num);
}
void phone::print()
{
  cout<<name<<":"<<tell;
  cout<<"\n";
}
main()
{
   phone *p;
   p=new phone;
   if(!p)
   {  
     cout<<"Alloction error.";
	 return 1;
	}
	p->store("Wang Qi Sheng","010 66745678");
	p->print();
	delete p;
	return 0;
}

⌨️ 快捷键说明

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