new 创建动态结构小例子
2016-07-13 09:50
387 查看
#include <iostream> #include <string> const int Size = 20; char name[Size]; struct sss { char name[Size]; double A; double B; }; int main() { using namespace std; sss *s = new sss; cout << "Please to Enter the A:"; cin >> s->A; cin.get(); // 这个是重点,没有此行就无法读取下边一行代码, cout << "Enter the name:"; cin.getline(s->name,20); cout << "Enter the B:"; cin >> s->B; cout << "Weight: " << s->A << endl; cout << "Name: " << s->name << endl; cout << "Caloar: " << s->B << endl; delete s; return 0; }
相关文章推荐
- 汇编指令机器码对应列表
- 操盘技巧 | 散户为什么总是拿不住股票?深度挖掘散户心理
- STL关联式容器之映射表——map
- 采用Atlas mysql 读写分离工具
- UTF-8、GBK编码的区别
- 经验分享:Xcode 创建.a和framework静态库
- 微信公众号开发教程[006]-PHP使用CURL详解
- 如何通过HTTPS方式访问webservice
- 三张图看遍Linux 性能监控、测试、优化工具
- hdu 2391 filthy rich
- 在leangoo里列表一般怎么设置?
- Core Data修改了Data Model文件后报错
- Drawerlayout,ActionBarDrawetoggle,NavigationView使用
- JAVA反射机制
- Nandflash镜像尾部不应填充0xFF
- C# string bytes互转
- iOS书摘之Objective-C编程之道 iOS设计模式解析
- iOS开发支付集成之银联支付
- 大学两年来学到的东西和五月到六月学到的东西
- Java随机数的生成