-
实验2
##实验任务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(con -
实验2
任务1: 源代码截图: 运行结果截图: 任务2: 源代码截图: 运行结果截图: 任务3: 源代码截图: 运行结果截图: 任务4: 源代码截图: 运行结果截图: -
实验二
task1 T.h 点击查看代码 #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T &t); // 复制构造函数 T(T &&t); // 移动构 -
实验三
实验任务1 问题1:将输入的分数整除10,再通过switch函数输出相应的等级,并返回到ans中。形参类型是整型,返回值是字符串。 问题2:由于缺少break,当其中一行满足时,后面的代实验任务2 实验任务2 问题1:将输入的整数n的每一位上的数字相加,并返回到ans中。 问题2:可以。第一种是将整 -
实验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_grad -
实验3
1.实验任务1 task1.c 点击查看代码 #include<stdio.h> char score_to_grade(int score); int main(){ int score; char grade; while(scanf("%d",&score) != EOF){ grade = -
实验2
实验任务1 代码组织: T.h 内容:类T的声明、友元函数声明 T.cpp 内容:类T的实现、友元函数实现 task1.cpp 内容:测试模块、main函数 T.h #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = -
实验三
task 1 源代码: 1 #include<stdio.h> 2 3 char score_to_grade(int score); 4 5 int main(){ 6 int score; 7 char grade; 8 9 while(scanf("%d",&score)!= EOF){ 10 -
实验二
1、实验任务一 源代码: #include "T.h" #include <iostream> #include <string> // 类T实现 // static成员数据类外初始化 const std::string T::doc{"a simple class sample"}; const -
实验3
一 #include<stdio.h> char score_to_grade(int score); int main() { int score; char grade; while(scanf("%d",&score)!=EOF) { grade=score_to_grade(score); -
实验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_grade(sc -
实验2
实验任务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 & -
实验3
实验1 源代码 1 #include <stdio.h> 2 char score_to_grade(int score); 3 int main() { 4 int score; 5 char grade; 6 while(scanf("%d", &score) != EOF) { 7 grade -
OOP实验2
实验任务一: 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 display() -
实验2
实验任务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); -
实验3
试验任务1 1 #include <stdio.h> 2 char score_to_grade(int score); // 函数声明 3 int main() { 4 int score; 5 char grade; 6 while(scanf("%d", &score) != EOF) { 7 -
实验二
任务一 #pragma once #include <string> // 类T: 声明 class T { // 对象属性、方法 public: T(int x = 0, int y = 0); // 普通构造函数 T(const T &t); // 复制构造函数 T(T &&t); // 移动构 -
实验作业2
四、实验结论 实验内容1 代码1 T.cpp 1 #include "T.h" 2 #include <iostream> 3 #include <string> 4 5 // 类T实现 6 7 // static成员数据类外初始化 8 const std::string T::doc{"a sim -
实验2
任务一:T.h #pragma once #include<string> //类T:声明 class T{ //对象属性、方法 public: T(int x=0,int y=0); //普通构造函数 T(const T &t); //复制构造函数 T(T &&t); //移动构造函数 ~T(); -
实验2
实验任务1: 源代码T.h 1 #pragma once 2 #include<string> 3 4 class T{ 5 public: 6 T(int x=0,int y=0); 7 T(const T &t); 8 T(T &&t); 9 ~T(); 10 11 void adjust(in