首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

new&delete示范运用

2013-02-15 
new&delete示例运用#include iostream#include stringusing namespace stdstruct student{ int num

new&delete示例运用
#include <iostream>
#include <string>
using namespace std;
struct student
{
 int num;
 string name;
 string sex;
};
int main()
{
 student*p;
 p=new student;
 p->num=110;
 p->name="陆岩";
 p->sex="男";
 cout<<p->num<<endl<<p->name<<endl<<p->sex<<endl;
 delete p;
 return 0;
}

热点排行