自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(88)
  • 收藏
  • 关注

原创 C++ Primer Plus 第十八章 课后编程练习题

//1题//////////////////////////////////////////////////////////////////////////////////////#include < iostream>#include < initializer_list>template< typename T>T average_list(std::initializer_list l){T tot = 0;for (auto p = l.begin(

2020-06-28 09:29:17 186

原创 C++ Primer Plus 第十七章 课后编程练习题

1题////////////////////////////////////////////////////////////////////////////////////////////#include < iostream>int main(){using namespace std;long num = 0;char ch;cout <<“请输入一些字符:\n”;cin.get(ch);cout <<"字符前边的字符是:";while(ch!=′字

2020-06-09 21:42:06 253

原创 C++ Primer Plus 第十六章 课后编程练习题

//1题///////////////////////////////////////////////////////////////////////#include #include bool huiwen(std::string & s);int main(){std::string st;std::cout <<“请输入字符串: (输入quit退出)”;std::cout << std::endl;while (std::cin >> st

2020-05-11 21:00:32 235

原创 C++ Primer Plus 第十五章 课后编程练习题1-4

//1题//////////////////////////////////////////////////////////////////////////////////////////////类定义#ifndef tv_remote_hpp#define tv_remote_hppclass Remote;class Tv{public:friend class Remote;...

2020-04-11 10:43:41 173

原创 C++ Primer Plus 第十四章 课后编程练习题1-5

//1题///////////////////////////////////////////////////////////////////////////////////////////类声明#ifndef wine_hpp#define wine_hpp#include #include #include template <class T1, class T2>...

2020-03-21 10:25:23 222

原创 C++ Primer Plus 第十三章 课后编程练习题1-4

//1题//类定义, 由于没有使用new分配内存,所以系统自己提供的默认构造函数, 复制构造函数, 赋值运算符, 和析构函数都可以使用。#ifndef base_hpp#define base_hppclass Cd{private:char performers[50]; //表演者char label[20]; //唱片公司int selections; ...

2020-03-01 18:00:59 175

原创 c primer plus 第十七章课后编程4题

//接口文件定义#ifndef QUEUE_H#define QUEUE_H#include <stdbool.h>//在这里插入Item类型的定义,例如typedef struct item {long arrive; //一位顾客加入队列的时间int processtime; //该顾客咨询时话费的时间}Item; //...

2020-02-25 16:08:54 201

原创 C++ Primer Plus 第十二章 课后编程练习题1-6

//1题//类定义#ifndef cow_hpp#define cow_hppclass Cow{private:char name[20];char * hobby;double weight;public:Cow();Cow(const char * nm, const char * ho, double wt);Cow(const Cow & c);~Co...

2020-02-22 17:40:41 235

原创 C++ Primer Plus 第十一章 课后编程练习题1-8

//1题//类定义#ifndef vector_hpp#define vector_hpp#include namespace VECTOR{class Vector{//枚举public:enum Mode {RECT, POL}; //rect 直角坐标, pol 极坐标private://类私有成员double x; //矢量X分量double y; //矢...

2020-02-14 15:37:09 168

原创 C++ Primer Plus 第十章 课后编程练习题1-8

//1//类声明文件.h#ifndef bank_hpp#define bank_hpp#include class BankAccount{private:std::string fullname;std::string account;double deposit;public://默认构造函数BankAccount();//录入函数BankAccount(st...

2020-02-06 20:49:01 253

原创 原创 C++ Primer Plus 第九章 课后编程练习题1-4

//1题//golf.cpp#ifndef GOLF_H_#define GOLF_H_const int Len = 40;struct golf{char fullname[Len]; //选手全名int handicap; //高尔夫球差点};//接受: 一个golf类的结构引用, 一个全名指针, 一个代表高尔夫球差点的int类型//用途: 把接受...

2020-01-31 19:08:32 229

原创 原创 C++ Primer Plus 第八章 课后编程练习题1-7

//1题#include int number = 1;void show(char *, int n = number);using namespace std;int main(){char a[] = “wo jiao wxp!”;show(a);show(a);show(a);return 0;}void show(char * a, int n){for ...

2020-01-26 10:13:29 297

原创 原创 C++ Primer Plus 第七章 课后编程练习题1-9

//1题#include double harmonic_mean(double, double);int main(){using namespace std;double a,b;double har_m;cout <<"请输入俩个数: “;while (cin >> a >> b && a !=0 && b...

2020-01-12 11:06:23 178

原创 原创 C++ Primer Plus 第六章 课后编程练习题1-9

//1题#include #include int main(){using namespace std;int i = 0;char a[100];char ch;cout <<“请随意输入不超过100的字符,输入@退出。” << endl;cin.get(ch);while (ch != ‘@’ && i < 100){i...

2020-01-05 19:34:49 128

原创 原创 C++ Primer Plus 第五章 课后编程练习题1-10

//1题#include int main(){using namespace std;int large, small,total = 0;cout <<"请输入一个较小的数: ";cin >> small;cout <<“请输入一个较大的数: “;cin >> large;for (int i = small; i <=...

2019-12-29 20:04:11 142

原创 原创 C++ Primer Plus 第四章 课后编程练习题1-10

1题。。。#include #include int main(){using namespace std;char fname[40];char lname[40];char achievement;int age;cout <<"What is your first name? ";cin.getline(fname, 40);cout <<"w...

2019-12-25 09:07:54 151

原创 C++ Primer Plus 第三章 课后编程练习题1-7

1 .#include int main(){using namespace std;const double inch_foot = 0.0833333;int myheight_in;cout <<“请输入你的身高(英寸)______\b\b\b\b\b\b”;cin >> myheight_in;cout << “你的身高是 " <...

2019-12-17 11:13:25 130

原创 C++ Primer Plus 第二章 课后编程练习题2-7

2.。。。。。#include int main(){using namespace std;int llong;cout << “请输入一个以long为单位的距离:” << endl;cin >> llong;cout << llong << " long单位的距离,等于" << llong*220 <...

2019-12-14 20:19:33 175

原创 c primer plus 第十七章课后编程3题

/*假设list.h(程序清单17.5)中的函数以适应新的定义,并通过films.c(程序清单17.4)测试最终的代码#define MAXSIZE 100typedef struct list{Item entries[MAZSIZE];int items;}List;重写list.c中的函数以适应新的定义,只修改了list.c中的代码,没有对films.c 和list.h 作...

2019-12-11 20:54:47 130

原创 c primer plus 第十七章课后编程2题

/把程序清单17.3使用下面的定义:/typedef struct list {Node *head; /指向list的开头/Node *end; /指向list的末尾/}List;/不用修改主函数,只修改了程序清单17.5中的函数以适应新的定义,所以只发修改的list.c/#include “list.h”#include &l...

2019-12-11 09:38:36 147

原创 c primer plus 第十七章课后编程1题

#include <stdio.h>#include <stdlib.h>#include <string.h>#define TSIZE 45struct film {char title[TSIZE];int rating;struct film *next;};//使用递归从底层开始观察链表void digui(struct f...

2019-12-09 07:54:05 119

原创 c primer plus 第十六章课后编程7题

#include <stdio.h>#include <stdlib.h>#include <stdarg.h>void show_array(const double ar[], int n); //打印double *new_d_array(int n, …);int main(void){double * p1;double * p2;...

2019-12-02 18:35:24 91

原创 c primer plus 第十六章课后编程6题

#include <stdio.h>#include <stdlib.h>#include <string.h>#define NUM 40struct names {char last[NUM];char first[NUM];};void showarray(const struct names ar[],int n);int mycomp...

2019-12-01 21:48:44 113

原创 c primer plus 第十六章课后编程5题

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#define MAX 1000#define RANDOM_M 21int main(void){int number1[MAX];int number_p[RANDOM_M];i...

2019-12-01 20:41:53 94

原创 c primer plus 第十六章课后编程3题

#include <stdio.h>#include <math.h>#define PI 3.14159265struct polar_coordinates {double r;double a;};struct rectangular_coordinates {double x;double y;};struct rectangular_coor...

2019-11-30 21:37:50 96

原创 c primer plus 第十六章课后编程2题

//用宏函数定义俩个数的调和平均数#include <stdio.h>#define HARMONIC_MEAN(X,Y) 2/((1/X)+(1/Y))int main(void){double x=5.0;double y=13.0;printf(“x and y Harmonic mean: %lf\n”,HARMONIC_MEAN(x,y));return 0;...

2019-11-30 20:29:15 74

原创 c primer plus 第十五章课后编程7题

#include <stdio.h>#include <stdbool.h>struct set_up {unsigned int id : 8; //24-31 储存ID信息unsigned int size : 8; //16-23位 字体大小unsigned int : 2; //14 15位 空unsigne...

2019-11-21 09:04:20 217

原创 c primer plus 第十五章课后编程6题

#include <stdio.h>#include <stdbool.h>#define ID_MAX 255#define SIZEMAX 127struct set_up {unsigned int id : 8;unsigned int size : 8;unsigned int :...

2019-11-20 19:23:07 166

原创 c primer plus 第十五章课后编程5题

#include <stdio.h>#define SIZE 33int rotate_l(unsigned int x,int n);char *alien_character(unsigned int number); // 把十进制无符号int类型数值转换成二进制数组显示int main(void){unsigned int number;unsigned int...

2019-11-19 09:26:14 112

原创 c primer plus 第十五章课后编程4题

#include <stdio.h>int open_close(int n,int w);int main(void){int n=113;int w=6;int k;k=open_close(n,w);printf("%d的二进制中的%d位是%d.\n",n,w,k);return 0;}int open_close(int n,int w){int o;...

2019-11-18 21:48:49 105

原创 c primer plus 第十五章课后编程3题

#include <stdio.h>int open_bit(int n);int main(void){int number=7;int i=open_bit(number);printf("%d的打开位有%d个。\n",number,i);return 0;}int open_bit(int n){int i,j,k=0;j=8*sizeof(int); ...

2019-11-18 21:05:05 122

原创 c primer plus 第十五章课后编程2题

#include <stdio.h>#include <stdlib.h>#include <ctype.h>#define SIZE 33int int_values(const char *pbin); // 把接受的参数转换为int 数值返回给主函数char *alien_character(int number); ...

2019-11-18 20:07:51 109

原创 c primer plus 第十五章课后编程1题

#include <stdio.h>#include <string.h>int int_values(char *);#define SIZE 33int main(void){char * pbin;char rjz[33];int number=0;printf(“请输入需要转换的二进制:(输入q退出)\n”);//循环输入二进制转换为十进制wh...

2019-11-12 20:00:18 97

原创 c primer plus 第十四章课后编程11题

#include <stdio.h>#include <math.h>#define MAX 10//源数组元素*2double jj(double a);//源数组元素+10double kk(double a);void transform(double *,double ,int ,double() (double));//double类型数据源数组...

2019-11-07 09:53:33 137

原创 c primer plus 第十四章课后编程10题

#include <stdio.h>void p1(void);void p2(void);void p3(void);void p4(void);void (*p[4]) (void)={p1,p2,p3,p4};int main(void){int i;while(1){printf(“请选择菜单0) .1)。 2)。 3)。 4)退出\n”);scanf(...

2019-11-07 08:57:42 104

原创 c primer plus 第十四章课后编程9题

#include <stdio.h>#include <string.h>#define MAXNAME 20#define MAXSEAT 12#define HB 4//结构框架struct seat{int number;int reserve;char name[MAXNAME];char sname[MAXNAME];char yn;}...

2019-11-06 22:10:29 121

原创 c primer plus 第十四章课后编程8题

#include <stdio.h>#include <string.h>#define MAXNAME 20#define MAXSEAT 12//结构框架struct seat{int number;int reserve;char name[MAXNAME];char sname[MAXNAME];};//预定座位void Reserved_s...

2019-11-05 11:56:22 156

原创 c primer plus 第十四章课后编程6题

#include <stdio.h>#include <stdlib.h>#define MAX 20typedef struct info {int nmber;char fname[MAX];char sname[MAX];int second;int hit;int run;int dot;}INFOR;int main(int argc, ...

2019-10-26 22:08:27 170

原创 c primer plus 第十四章课后编程5题

#include <stdio.h>#include <string.h>#define MAX 20#define CJ 3struct name{char fname[MAX];char sname[MAX];};struct student{struct name k;float grade[3];float average;};char ...

2019-10-22 09:28:22 90

原创 c primer plus 第十四章课后编程4题

//编写有俩个成员的结构,第一个成员是社会保险号,第二个成员是有三个成员//的结构,1.成员代表名。2。中间名。3。姓//程序a.#include <stdio.h>#include <string.h>#define MAX 20#define SZ 5struct fname{char name[MAX];char zname[3];char sn...

2019-10-20 10:11:07 214

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除