
学习
Tekkenwxp
这个作者很懒,什么都没留下…
展开
-
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 · 224 阅读 · 0 评论 -
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 · 347 阅读 · 0 评论 -
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 · 291 阅读 · 0 评论 -
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 · 233 阅读 · 0 评论 -
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 · 292 阅读 · 0 评论 -
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 · 227 阅读 · 0 评论 -
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 · 252 阅读 · 0 评论 -
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 · 311 阅读 · 0 评论 -
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 · 220 阅读 · 0 评论 -
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 · 350 阅读 · 0 评论 -
原创 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 · 283 阅读 · 0 评论 -
原创 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 · 397 阅读 · 0 评论 -
原创 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 · 264 阅读 · 0 评论 -
原创 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 · 176 阅读 · 0 评论 -
原创 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 · 180 阅读 · 0 评论 -
原创 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 · 285 阅读 · 0 评论 -
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 · 205 阅读 · 0 评论 -
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 · 258 阅读 · 0 评论 -
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 · 172 阅读 · 0 评论 -
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 · 198 阅读 · 0 评论 -
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 · 163 阅读 · 0 评论 -
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 · 130 阅读 · 0 评论 -
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 · 150 阅读 · 0 评论 -
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 · 136 阅读 · 0 评论 -
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 · 146 阅读 · 0 评论 -
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 · 259 阅读 · 0 评论 -
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 · 219 阅读 · 0 评论 -
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 · 150 阅读 · 0 评论 -
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 · 139 阅读 · 0 评论 -
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 · 167 阅读 · 0 评论 -
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 · 155 阅读 · 0 评论 -
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 · 148 阅读 · 0 评论 -
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 · 198 阅读 · 0 评论 -
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 · 146 阅读 · 0 评论 -
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 · 161 阅读 · 0 评论 -
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 · 219 阅读 · 0 评论 -
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 · 204 阅读 · 0 评论 -
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 · 127 阅读 · 0 评论 -
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 · 260 阅读 · 0 评论 -
c primer plus 第十四章课后编程3题
//修改14.2 1、按照输入顺序。2、按照标题字母的声明输出图书的信息。3、按照价格(升序从小到大)#include <stdio.h>#include <string.h>char *s_gets(char *st,int n);#define MAXTITL 40#define MAXAUTL 40#define MAXBKS 100str...原创 2019-10-17 21:14:43 · 170 阅读 · 0 评论