c++ primer plus 习题5.7(使用new为结构创建动态数组)
来源:互联网 发布:10年前的网络歌曲 编辑:程序博客网 时间:2024/06/06 16:32
#include<iostream>using namespace std;struct car{string brand;int year;};int main(){int num,i;cout<<"How many cars do you wish to catalog?";cin>>num;car *pz= new car[num] ;for(i=1;i<=num;i++){cout<<"Car #"<<i<<"\n";cout<<"Please enter the make:";cin>>pz[i-1].brand;cout<<"Please enter the year made:";cin>>pz[i-1].year;}cout<<"Here is your collection:\n";for(i=0;i<num;i++){cout<<pz[i].brand<<"\t"<<pz[i].year<<"\n";}delete [] pz;}
0 0
- c++ primer plus 习题5.7(使用new为结构创建动态数组)
- C Primer Plus学习 四十八 使用结构数组的函数
- C Primer Plus学习 四十四 结构数组
- 创建动态数组(c++primer)
- c primer Plus第一章习题
- C Primer plus 习题5.3
- 使用new创建动态结构
- 使用new创建动态数组
- C primer plus第1章(概览)习题
- C primer plus第9章(函数)习题
- C primer plus第10章(指针)习题
- C++primer plus(第四版)第五章习题参考
- C primer plus课后习题答案(部分)
- C++primer 4.3 动态数组 、 动态内存分配 new delete
- c primer plus第14章习题
- c primer plus 第二章习题摘录
- 《C Primer Plus》第一章 概览 课后习题
- C Primer Plus 第五章习题
- select into from 和 insert into select 的用法和区别
- 最新的IOS在windows环境下编译环境搭建记录
- UVa 253 Cube painting(骰子涂色)
- jQuery实战笔记(一)-jQuery基本原理
- 再谈大可乐3:众筹昭示未来可期
- c++ primer plus 习题5.7(使用new为结构创建动态数组)
- Java开发中的23种设计模式详解(转)
- CSS基础知识总结--《CSS权威指南》阅读笔记(一)
- (转)林达华推荐的几本数学书
- java设计模式中的5种写单例的方式
- 在 github 上获取源码
- Extjs 关于列column 排序问题
- Apache Storm 集群环境搭建
- String类练习二