编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习6
#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的更多相关文章
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9
#include <iostream> #include <fstream> #include <cstdlib> #include <string> ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8
#include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7
#include <iostream> #include <string> #include <cctype> using namespace std; int m ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6
#include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5
#include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4
#include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showm ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3
#include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2
#include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1
#include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9
#include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...
随机推荐
- gulp构建自动化项目
'use strict'; var gulp = require('gulp'), browserSync = require('browser-sync').create(), SSI = requ ...
- LOCK TABLES 和 UNLOCK TABLES
MySQLdump的时LOCK TABLES 和 UNLOCK TABLES 在mysqldump后的数据中会发现有 LOCK TABLES tables_name WRITE;和结尾处有 UNLOC ...
- WCF+Autofac 实现构造函数依赖注入
1.新建一个项目 2.要对WCF服务实现Autofac注入,需要实现2个接口,IInstanceProvider与IServiceBehavior,并让实现IServiceBehavior的类成为一个 ...
- 没有IDE的日子
没有QT Creator,没有VS2008,没有Eclipse,也没有KDevelop,忘掉一切IDE. 好吧,现在我只有Vim了,可我跟Vim不熟. Vim魅力四射,光芒万丈,高高在上,她就是传说中 ...
- vsftp 基于虚拟用户的ftp服务器 如何做配额
做配额的方法: 1,是用磁盘配额,但是虚拟用户好像没有好办法.只能应用于本地用户.与Vsftpd设置无关 2,文件夹限制大小,是占用的.这和Vsftpd没有关系 所以可以先把用户禁锢在自己工作目录里面 ...
- js判断手机邮箱格式(正则)
function fun() { var realname = document.getElementById("realname"); var telephone = docum ...
- Python学习(五) —— 文件操作
一.文件操作 1.文件操作:数据持久化的一种 步骤:找到文件,打开文件,操作:读.写.追写,关闭文件 打开文件:f = open(文件路径,操作模式,编码方式),f:文件句柄.文件 ...
- Codeforces 935E Fafa and Ancient Mathematics dp
Fafa and Ancient Mathematics 转换成树上问题dp一下. #include<bits/stdc++.h> #define LL long long #define ...
- js拷贝
现在有一个对象 var obj = { name: '隔壁老王', age: 60, sex: 'male' } 我们现在想把obj里的每一个属性拷贝到一个空对象var obj1 = {}中,那么需要 ...
- Codeforces Gym100187C Very Spacious Office 贪心 堆
原文链接https://www.cnblogs.com/zhouzhendong/p/CF-Gym100187C.html 题目传送门 - CF-Gym100187C 题意 给定 $n$ 个房间以及 ...