摘要: 不用string实现字符串连接 include include include define N 100 using namespace std; int main(void){ char a[N]; char b[N]; char c[2 N]; int i; cout a; cout b; in 阅读全文
posted @ 2019-04-14 22:46 天真王二小 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 问题描述: 用指针完成数组的赋值,输出,求最大值,最小值 include include include int main(void){ int p,a[10],max,min; srand(time(NULL)); for(p=a;p p) min= p; std::cout 阅读全文
posted @ 2019-04-14 22:37 天真王二小 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 定义一个结构体,成员包括:学号,姓名,性别,出生日期,成绩,住址,电话。 要求输入5个学生的信息,并输出。 include using namespace std; struct student{ int num; char name[10]; char sex[10]; char bi 阅读全文
posted @ 2019-04-14 22:34 天真王二小 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 编写一个基于面向对象的程序,求数组的最大值,并对数组进行排序。 (要求在类外定义函数成员) include include include using namespace std; class array{ private: int a[10]; public: void set_arr 阅读全文
posted @ 2019-04-14 22:28 天真王二小 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 声明10个元素的整型数组 (1)给数组元素赋值(两位随机整数) (2)输出该数组的元素 用冒泡法升序排序并输出 用选择法降序排序并输出 include include include int main(void){ int a[10]; int i,j; srand(time(NULL) 阅读全文
posted @ 2019-04-14 22:26 天真王二小 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 声明一个10个元素的整型数组(用随机函数赋值), 用选择法对数组进行排序,要求用函数完成 include include include void sort(int a[],int n){ int i,j,max,max_k,temp; for(i=0;imax){ max=a[j]; 阅读全文
posted @ 2019-04-14 22:22 天真王二小 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 声明一个5行5列的二维数组,用随机函数给数组赋值(3位整数) (1)输出该二维数组 (2)求二维数组元素的最大值 (3)求主对角线元素之和,次对角线元素之和 include include include int main(void){ int i,j,a[5][5],max,sum1= 阅读全文
posted @ 2019-04-14 22:19 天真王二小 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 用递归方法求f(n)=累加i^2,(i=1~n) include double fac(int n){ double s; if(n==1) s=1; else s=fac(n 1)+n n; return s; } int main(void){ int n,s; std::cout 阅读全文
posted @ 2019-04-14 22:15 天真王二小 阅读(697) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 求a!+b!+c!的值,用一个函数fac(n)求n!。 a,b,c的值由主函数输入,最终得到的值在主函数中输出 include double fac(int n){ if(n==1){ return 1; } else return n fac(n 1); } int main(void 阅读全文
posted @ 2019-04-14 22:12 天真王二小 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 用while语句求1!+2!+3!+...+10! include include using namespace std; int main(void){ int a=1,i=1,sum=0; while(i 阅读全文
posted @ 2019-04-14 22:12 天真王二小 阅读(1318) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 声明10个元素的整型数组 (1)给数组元素赋值(两位随机整数) (2)输出该数组的元素 (3)求数组元素的最大值,最小值并输出 (4)求数组元素的总和,平均值并输出 include include include int main(void){ int a[10]; int i; sra 阅读全文
posted @ 2019-04-14 22:12 天真王二小 阅读(1231) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 1)角色类CRole为基类: 构造函数、析构函数; 成员变量:头像、HP(血量)、ATK(攻击力)、DEF(防御力)、Lv(等级),EXP(经验值); 成员函数:武器攻击、跳跃。 2)英雄类CHero继承于CRole类 构造函数、析构函数; 英雄类新增技能踢腿(成员函数)、抱摔(成员函数 阅读全文
posted @ 2019-04-14 21:42 天真王二小 阅读(454) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 创建双向链表类,该类有默认构造函数、类的拷贝函数、类的析构函数、实现链表添加数据、升序排序、查找链表中某个节点及删除链表中某个节点的操作(禁用STL及String类))。 “dLinkList.h” "dLinkList.cpp" include"pch.h" include"dLink 阅读全文
posted @ 2019-04-14 21:42 天真王二小 阅读(539) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 编码实现字符串类CNString,该类有默认构造函数、类的拷贝函数、类的析构函数及运算符重载,需实现以下“=”运算符、“+”运算、“[]”运算符、“”运算符及“==”运算符(备注:可以用strcpy_s, strcat_s,但禁用STL及String类),以下为各个运算符的运算效果的详细 阅读全文
posted @ 2019-04-14 21:32 天真王二小 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 描述: 编写递归函数char itostr (int n,char string),该函数将整数n转换为十进制表示的字符串。(提示:使用递归方法) include include define N 100 int i = 0; char itostr(int n, char string) { if 阅读全文
posted @ 2019-04-14 21:18 天真王二小 阅读(834) 评论(0) 推荐(0) 编辑