📄 8-1.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 + -