#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. 我眼里K-Means算法

    在我眼里一切都是那么简单,复杂的我也看不懂,最讨厌那些复杂的人际关系,唉,像孩子一样交流不好吗. 学习K-Means算法时,会让我想起三国志这个游戏,界面是一张中国地图,诸侯分立,各自为据.但是游戏开 ...

  2. (二叉树 DFS 递归) leetcode 112. Path Sum

    Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...

  3. filebeat+logstash配置

    一. filebeat.yml的配置 filebeat.prospectors:- input_type: log paths: - /tmp/logs/optimus-activity-api.lo ...

  4. linux在线安装JDK(1.8版本)

    在线下载JDK 命令: wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-sec ...

  5. 数据库之数据库管理篇[mysql]

    管理数据库 1.mysql开闭使用篇 mariadb在Linux中首次进入mysql(因为此时还没有创建任何用户,mysql的root并不等效于linux中的root用户) sudo mysql 进入 ...

  6. 【汇总目录】C#

    [2019年04月29日] C# textbox 自动滚动 [2019年02月07日] C#利用VUDP.cs开发网络通讯应用程序 [2019年02月06日] C#利用VINI.cs操作INI文件 [ ...

  7. Linux下使用crontab对MYSQL进行备份以及定时清

      数据备份是一个项目必需的工作,保证数据库出问题时,将损失减小到最低.本文记录下linux服务器中使用脚本对MYSQL数据备份,并且定时清除7天前的备份. crontab定时备份 1.创建备份目录 ...

  8. ado.net 之 oracle 数据库

    ado.net 操作oracle 数据库 跟操作mssql 的原来基本一样.只是使用不同的命名空间而已.下面举几个例子: 一. C#读取oracle数据库的表格 ///ado.net 读取table ...

  9. DeepLearning.ai学习笔记(四)卷积神经网络 -- week4 特殊应用:人力脸识别和神经风格转换

    一.什么是人脸识别 老实说这一节中的人脸识别技术的演示的确很牛bi,但是演技好尴尬,233333 啥是人脸识别就不用介绍了,下面笔记会介绍如何实现人脸识别. 二.One-shot(一次)学习 假设我们 ...

  10. TCP-IP详解笔记4

    TCP-IP详解笔记4 系统配置: DHCP和自动配置 每台主机和路由器需要一定的配置信息,配置信息用于为系统指定本地名称,及为接口指定标识符(如IP地址). 提供或使用各种网络服务,域名系统(DNS ...