#include <iostream>
#include <string>
using namespace std;
struct car
{
 string pro;
 int  year;
};
int main()
{
 int num;
 cout<<"How many cars do you wish to catalog? ";
 (cin>>num).get();//注意将输入后的回车键转换成的换行符读取并丢弃
 car *newcar=new car[num];
 for(int i=0;i<num;i++)
 {
  cout<<"Car #"<<i+1<<":"<<endl;
  cout<<"Please enter the make: ";
  getline(cin,newcar[i].pro);
  cout<<"Please enter the year made: ";
  (cin>>newcar[i].year).get();//注意将输入后的回车键转换成的换行符读取并丢弃 
 cout<<"Here is your collection:"<<endl;
 for(int j=0;j<num;j++)
  cout<<newcar[j].year<<" "<<newcar[j].pro<<endl;
 delete [] newcar;//删除开辟的动态空间
 system("pause");
 return 0;
}

编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习6的更多相关文章

  1. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9

    #include <iostream> #include <fstream> #include <cstdlib> #include <string> ...

  2. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8

    #include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...

  3. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7

    #include <iostream> #include <string> #include <cctype> using namespace std; int m ...

  4. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6

    #include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...

  5. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5

    #include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...

  6. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4

    #include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...

  7. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3

    #include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...

  8. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2

    #include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...

  9. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1

    #include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...

  10. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9

    #include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...

随机推荐

  1. Kubenetes 资源清单定义入门

    Kubernetes 常用资源 资源  对象 工作负载型资源对象(workload): Pod  Replicaset  ReplicationController  Deployments Stat ...

  2. 劫持 Opengl32.dll 实现游戏MOD

    前提是你的游戏是用的Opengl,如果是DX的,自行谷歌方法,应该差不多,参考GTA5 最近玩了款<天命奇御>的国产网游,自己手动写了个MOD,本来是直接修改Chap-Assembly.d ...

  3. react+antdesign

    http://scaffold.ant.design/#/scaffolds/ng-alain http://scaffold.ant.design/#/scaffolds/react-redux-a ...

  4. 邮箱学堂:SPF详解

    [中国邮箱网 电子邮件频道]   1月18日,什么是SPF?关于SPF的一些基础知识有哪些?SPF有哪些需求?什么是SPF的TXT记录?本文的微软Exchange专家围绕SPF做了非常详细的介绍与分析 ...

  5. dubbo和zikkeper的使用

    1.先来一段异常看看:No provider available for the service 16:05:25.755 [localhost-startStop-1] WARN o.s.w.c.s ...

  6. 模组 前后端分离CURD 组件

    js (function () { // {# -------------------------------------------------------------------------- # ...

  7. DeepLearning.ai学习笔记(五)序列模型 -- week2 自然语言处理与词嵌入

    一.词汇表征 首先回顾一下之前介绍的单词表示方法,即one hot表示法. 如下图示,"Man"这个单词可以用 \(O_{5391}\) 表示,其中O表示One_hot.其他单词同 ...

  8. Django 内置分页器

    先导入Django内置的分页器 在商品列表页或者购物车列表页导入 在渲染list.html导入 然后在views后台渲染方法写入 打开list页面结果

  9. CF1153E Serval and Snake

    题目地址:CF1153E Serval and Snake 这是一道交互题 由于只需要确定起点和终点 你选择的矩形会将整个矩形分成的两个部分 如果起点和终点在同一个部分里,那么很显然回答应该是个偶数 ...

  10. redis 数据结构及应用场景

    1. String 常用命令: get.set.incr.decr.mget等 应用场景: String是最常用的数据类型,普通的key/value都可以归为此类,value其实不仅是String,也 ...