-
实验二
1实验任务一 T.h #pragma once #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T &t); // 复制构造函数 T(T &&t); -
实验二
1、实验任务1: T.h源代码: 1 #pragma once 2 3 #include <string> 4 5 class T { 6 7 public: 8 T(int x = 0, int y = 0); 9 T(const T &t); 10 T(T &&t); 11 ~T(); 12 1 -
实验三
实验任务1:问题1:函数作用:将分数梯度转化为ABCED 形参:整形 返回值:字符char 问题2:所有输入都进入defult的情况下,输出等级E 实验任务2:问题1:函数作用:求出输入值的各数位之和 问题2:能 问题3:原来是递归,改后是迭代 实验任务3:问题1:函数作用:求出x的n次方 问题2: -
experiment3
一、实验目的 能正确使用c语法规则定义、声明、调用函数 能正确编写递归函数 针对具体问题场景,能合理抽象出独立的功能模块,正确定义函数并使用,使得代码更具可读性、可维护性 二、实验准备 实验前,请复习第4章以下内容: 函数定义、声明、调用的语法规则 什么是形参、什么是实参,以及,参数传递和返回过程 -
实验二
任务1: 源代码task1.cpp #include "T.h" #include <iostream> void test_T(); int main() { std::cout << "test Class T: \n"; test_T(); std::cout << "\ntest frien -
实验3
`#define _CRT_SECURE_NO_WARNINGS include <stdio.h> char score_to_grade(int score); int main() { int score; char grade; while (scanf("%d", &score) != E -
实验二
任务一 T.h #pragma once #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T &t); // 复制构造函数 T(T &&t); // -
实验3
task1 整型 字符类型 `` 将输入的分数转换为对应的等级A、B、C、D、E,其中 90-100 为 A,80-89 为 B,70-79为 C,60-69分为 D,60下为 E case分支缺少break语句,会导致过度执行 task2 计算整数n的各位数字之和 能 循环实现 递归实现 task -
实验二
任务一: T.h 1 #pragma once 2 #include <string> 3 // 类T: 声明 4 class T { 5 // 对象属性、方法 6 public: 7 T(int x = 0, int y = 0); // 普通构造函数 8 T(const T &t); // 复制 -
oop-实验2
task1 T.h 1 #pragma 2 3 #include<string> 4 5 class T{ 6 public: 7 T(int x=0,int y=0); 8 T(const T &t); 9 T(T &&t); 10 ~T(); 11 12 void adjust(int rati -
实验二
实验任务1 源代码 T.cpp #include "T.h" #include <iostream> #include <string> // 类T实现 // static成员数据类外初始化 const std::string T::doc{"a simple class sample"}; con -
实验二
实验任务一 T.h源码 #pragma once #include <string> class T { public: T(int x = 0, int y = 0); T(const T &t); T(T &&t); ~T(); void adjust(int ratio); void disp -
实验二
task1 T.h #pragma once #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T& t); // 复制构造函数 T(T&& t); -
现代C++编程初体验
##实验任务1 ##代码 #pragma once #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T &t); // 复制构造函数 T(T &&t -
实验3
task1 点击查看代码 #include <stdio.h> char score_to_grade(int score); int main() { int score; char grade; while(scanf("%d", &score) != EOF) { grade = score_ -
实验二
task1: 代码组织: T.h 内容:类T的声明、友元函数声明 T.cpp 内容:类T的实现、友元函数实现 task1.cpp 内容:测试模块、main函数 T.h : #pragma once #include <string> // 类T: 声明class T { // 对象属性、方法 pub -
实验3
实验任务1 代码 #include <stdio.h> char score_to_grade(int score); int main() { int score; char grade; while(scanf("%d", &score) != EOF) { grade = score_to_g -
实验2 现代C++编程初体验
1. 实验任务1 T.h 1 #pragma once 2 3 #include <string> 4 5 // 类T: 声明 6 class T { 7 // 对象属性、方法 8 public: 9 T(int x = 0, int y = 0); // 普通构造函数 10 T(const T & -
实验二
#任务一 ##1.源代码 1.T.h #pragma once #include <string> // 类T: 声明 class T { // 对象属性、 方法 public: T(int x = 0, int y = 0); T(const T &t); T(T &&t); // 移动构造函数 -
实验2
任务1: #include "T.h" #include <iostream> void test_T(); int main() { std::cout << "test Class T: \n"; test_T(); std::cout << "\ntest friend func: \n";