使用new创建动态结构
来源:互联网 发布:linux 查看文件字符集 编辑:程序博客网 时间:2024/06/03 02:40
#include <iostream>struct inflatable //struck defination{ char name[20]; float volume; double price;};int main(){ using namespace std; inflatable* ps= new inflatable;//为结构体分配内存空间 cout<<"Enter name of inflatable item: "; cin.get(ps->name,20);//method 1 for member access cout<<"Enter volume in cubic feet: "; cin>>(*ps).volume;//method 2 for member acess cout<<"Enter price: $"; cin>>ps->price; cout<<"Name: "<<(*ps).name<<endl;//method 2 cout<<"Volume: "<<ps->volume<<" cubic feet\n";//method 1 cout<<"Price: $"<<ps->price<<endl;//method 2 //如果结构标识符是结构名,则使用句点运算符;如果标识符是指向结构的指针,则使用箭头运算符 delete ps; return 0;}
0 0
- 使用new创建动态结构
- 使用new来创建动态结构
- C++使用new创建动态结构
- 【C++学习笔记】使用new创建动态结构
- C++学习笔记五之使用new创建动态结构
- 使用new创建动态数组
- 用new动态创建结构体
- new 创建动态结构小例子
- 1.5 使用new创建动态结构和自动, 静态, 动态三种存储方式
- 使用new创建动态结构和自动, 静态, 动态三种存储方式
- c++ primer plus 习题5.7(使用new为结构创建动态数组)
- 使用new来创建动态数组
- C++ new创建动态结构(Notepad++ 运行C++实现)
- 创建和使用动态数组new char[10]
- 4.7.6 使用 new 来创建动态数组
- 【C++学习笔记】使用New来创建动态数组
- new int 创建动态内存
- 使用new创建数组
- web上传进度条案例
- 老男孩Python 第7期 老男孩Python培训视频教程
- leetcode解题之532. K-diff Pairs in an Array Java版
- Warning: Using innodb_additional_mem_pool_size is DEPRECATED
- GYM 101061 I.Playing with strings(水~)
- 使用new创建动态结构
- View体系
- docker安装
- C语言编程规范-注释
- leetcodeOJ 6. ZigZag Conversion
- Mac os 下 搭建 Apache Tomcat
- Android 文件的加密及解密
- Python高级编程技巧实战 基于Python项目与面试题讲解
- zookeeper zkCli.sh的基本使用方法