#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. JAVA 代码中使用中文的办法

    在编译代码中插入 -encoding UTF-8 示例: javac -encoding UTF-8 *.java

  2. H5实现轮播

    页面代码: <div id="body_wrapper" class="container"> <article> <sectio ...

  3. MyEclipse和tomcat结合编写jsp对于中文乱码的解决方法

    一.Java和jsp 中文乱码原因和解决方法: Java的内核和class文件是基于unicode的,这使Java程序具有良好的跨平台性,但也带来了一些中文乱码问题的麻烦.原因有两方面: 第一方面:J ...

  4. 修改Elasticsearch的settings

    解决:Limit of total fields [1000] in index [nginx-access-log] has been exceeded" 的问题 PUT http://1 ...

  5. javaScript事件(七)事件类型之键盘与文本事件

    键盘事件如下: keydown:当用户按下键盘上的任意键时触发,而且如果按住不放的话,会重复触发此事件. keypress:当用户按下键盘上的字符键时触发,而且如果按住不放的话,会重复触发此事件. k ...

  6. POJ 1364 / HDU 3666 【差分约束-SPFA】

    POJ 1364 题解:最短路式子:d[v]<=d[u]+w 式子1:sum[a+b+1]−sum[a]>c      —      sum[a]<=sum[a+b+1]−c−1  ...

  7. alpha冲刺10/10

    目录 摘要 团队部分 个人部分 摘要 队名:小白吃 组长博客:hjj 作业博客:冲刺倒计时之10(匆匆而过) 团队部分 后敬甲(组长) 过去两天完成了哪些任务 答辩演练 版本演示视频拍摄 接下来的计划 ...

  8. Python 面向对象3-类变量与实例变量

    #!/usr/bin/env python # -*- coding:utf-8 -*- # 作者:Presley # 邮箱:1209989516@qq.com # 时间:2018-08-05 # O ...

  9. 移动端1px问题

    .component-confirm__buttons { border-top: 1px solid #eceef0; box-shadow: 0 1px 1px #fff; } 造成边框变粗的原因 ...

  10. POJ3076 Sudoku 舞蹈链 DLX

    欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目(传送门) 题意概括 给出一个残缺的16*16数独,求解. 题解 DLX + 矩阵构建  (两个传送门) 学完这个之后,再 ...