#include <iostream>
using namespace std;
struct CandyBar
{
 char kind[20];
 float weight;
 int calory;
};
void Display(CandyBar ca,int n)
{
    cout<<"The kind of ca["<<n<<"] is: "<<ca.kind<<endl;
 cout<<"The weight of ca["<<n<<"] is: "<<ca.weight<<endl;
 cout<<"The calory of ca["<<n<<"] is: "<<ca.calory<<endl;
}
int main()
{
  //声明,初始化
 CandyBar ca[3]=
 {
  {"Cindy Tian", 0.5, 366},
  {"Pax Congo", 70, 500},
  {"Young Yang", 54, 200}
 };
 Display(ca[0],1);
 Display(ca[1],2);
 Display(ca[2],3);
 system("pause");
 return 0;
}

编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习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. Git基础(三) 跟踪文件

    检查当前文件状态 git status 跟踪新文件 git add README 状态简览 git status -s 或 git status --short 忽略文件 创建一个名为.gitigno ...

  2. Angularjs 学习笔记-2017-02-06-双向数据绑定

    NG: ng-bind:  标签属性 ng-bind=" obj.xxx  " ,不会出现 用于区别{{ }} 标签,当页面未加载完毕时可以看到{{}}标签,非常不雅观,ng-bi ...

  3. spark操作Kudu之读 - 使用DataFrame API

    虽然我们可以通过上面显示的KuduContext执行大量操作,但我们还可以直接从默认数据源本身调用读/写API. 要设置读取,我们需要为Kudu表指定选项,命名我们要读取的表以及为表提供服务的Kudu ...

  4. mysql基础理论

    第一节数据库管理系统概述 在www.db-engines.com/en/ 这个网站中可以看到对数据库的排名 数据库分为: 关系型数据库: mysql------mariaDB oracle 非关系型数 ...

  5. Bootstrap 框架、插件

    Bootstrap,前端工程师比较常用的框架.插件,根据它的定义,我们不妨这样理解,Bootstrap就是用于前端开发的一个模板,就是别人做好了我们直接可以搬过来直接使用或者根据自己需要略加修改设计自 ...

  6. fillder---安装证书(抓取https)

    1.fillder中设置如下(不用管为啥,按照这个设置就对了) 2.需要在手机上安装证书,有两种方式 方式一:fillder直接导出到手机中 方式二:手机上直接下载 打开手机自带浏览器:网址输入[XX ...

  7. 实验3 敏捷开发与XP实践实验报告

    一.实验报告封面 课程:Java程序设计 班级:1653班 姓名:高君天 学号:20165319 指导教师:娄嘉鹏 实验日期:2018年4月27日 实验时间:13:45 - 3:25 实验序号:实验三 ...

  8. python和yum同时卸载后的安装方法

    centos 7如果卸载了yum和python之后恢复的办法(该方法已经测试). 1. 安装python. python-libs-2.7.5-34.el7.x86_64.rpm python-2.7 ...

  9. JavaOO面向对象中的注意点(一)

    1.JavaOO宗旨思想: ★万物皆对象,对象因关注而产生★ ☆类是对象的抽取,对象是类的实例☆ 2.JavaOO的三大特征: 封装.继承.多态  (第四大特征 抽象 现还有争议) 3.属性与行为: ...

  10. Running Median POJ - 3784 (对顶堆/优先队列 | 链表)

    For this problem, you will write a program that reads in a sequence of 32-bit signed integers. After ...