摘要: 题目描述: 声明一个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 天真王二小 阅读(1232) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 1)角色类CRole为基类: 构造函数、析构函数; 成员变量:头像、HP(血量)、ATK(攻击力)、DEF(防御力)、Lv(等级),EXP(经验值); 成员函数:武器攻击、跳跃。 2)英雄类CHero继承于CRole类 构造函数、析构函数; 英雄类新增技能踢腿(成员函数)、抱摔(成员函数 阅读全文
posted @ 2019-04-14 21:42 天真王二小 阅读(459) 评论(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 天真王二小 阅读(259) 评论(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) 编辑