-
实验6
实验任务1 源代码 #pragma once #include <iomanip> #include <iostream> #include <string> struct Contestant { long id; // 学号 std::string name; // 姓名 std::string -
实验6
一、实验结论 1. 实验任务1 程序源代码 contestant.hpp #pragma once #include <iomanip> #include <iostream> #include <string> struct Contestant { long id; // 学号 std::str -
实验6
实验任务1 源代码: 点击查看contestant.hpp #pragma once #include <<iomanip> #include <iostream> #include <string> struct Contestant { long id; // 学号 std::string na -
第五次作业
请用回溯法的方法分析“最小重量机器设计问题” 1.1最小重量机器设计问题” 的解空间是所有可能的部件 - 供应商选择组合 1.2解空间树: (1)解空间树是一棵n 层的 m 叉树 (2)树的层数对应部件的序号(第 1 层对应第 1 个部件,第 n 层对应第 n 个部件) (3)每一层的每个结点,有m -
实验六
任务一 contestant.hpp #pragma once #include <iomanip> #include <iostream> #include <string> struct Contestant { long id; // 学号 std::string name; // 姓名 st -
实验6
实验任务4 1 #include <stdio.h> 2 #include <stdlib.h> 3 #define N 10 4 5 typedef struct { 6 char isbn[20]; 7 char name[80]; 8 char author[80]; 9 double sal -
第五次作业
1.用回溯法的方法分析“最小重量机器设计问题” 1.1 说明“最小重量机器设计问题"的解空间 该问题的解空间为所有符合条件的“部件——供应商”分配方案的集合,其中每个解都是一个长度为n的有序向量 X = (x1, x2, ..., xn), xi表示第i个部件选择的供应商的编号。 1.2 说明 “最 -
实验6
实验任务4 1 #include <stdio.h> 2 #define N 10 3 4 typedef struct { 5 char isbn[20]; // isbn号 6 char name[80]; // 书名 7 char author[80]; // 作者 8 double sale -
算法第五章作业
一、回溯法分析最小重量机器设计问题 问题前提:机器包含 n 个部件,每个部件有 m 个供应商可选;wij 是第 i 个部件选第 j 个供应商的重量,cij 是对应成本;要求总成本不超过预算 C,总重量最小。 1.1 解空间 解是一个 n 维向量 X = (x₁, x₂, ... , x n),其中 -
实验六
1 #define _CRT_SECURE_NO_WARNINGS 2 #include <stdio.h> 3 #define N 10 4 5 typedef struct { 6 char isbn[20]; // isbn号 7 char name[80]; // 书名 8 char aut -
实验6
实验任务4 task4.c源代码 #include <stdio.h> #define N 10 typedef struct { char isbn[20]; // isbn号 char name[80]; // 书名 char author[80]; // 作者 double sales_pri -
实验6
实验任务1 实验任务2 实验任务3 3.1 实验任务4 #include <stdio.h> #define N 10 typedef struct { char isbn[20]; // isbn号 char name[80]; // 书名 char author[80]; // 作者 doubl -
实验6
实验任务1 task1.c 点击查看代码 #include <stdio.h> #include <string.h> #define N 3 // 运行程序输入测试时,可以把N改小一些输入测试 typedef struct student { int id; // 学号 char name[20] -
实验6
实验任务4 代码 #include <stdio.h> #define N 10 typedef struct { char isbn[20]; // isbn号 char name[80]; // 书名 char author[80]; // 作者 double sales_price; // 售 -
实验六
实验任务4 #include <stdio.h> #define N 10 typedef struct { char isbn[20]; // isbn号 char name[80]; // 书名 char author[80]; // 作者 double sales_price; // 售价 i -
实验6
task1 #include <stdio.h> #include <string.h> #define N 3 typedef struct Student{ int id; char name[20]; char subject[20]; double perf; double mid; dou -
实验六
task4 1 #include <stdio.h> 2 #define N 10 3 4 typedef struct { 5 char isbn[20]; // isbn号 6 char name[80]; // 书名 7 char author[80]; // 作者 8 double sale -
实验6 文件IO与异常处理
实验任务1 代码组织: contestant.hpp 结构体Contestant定义及其重载运算符函数>>和<<实现 utils.hpp 工具函数实现(排序函数、数据读/写) task1.cpp 应用代码 + main contestant.hpp #pragma once #include <io -
实验六
task 4 1 #include <stdio.h> 2 #define N 10 3 4 typedef struct { 5 char isbn[20]; // isbn号 6 char name[80]; // 书名 7 char author[80]; // 作者 8 double sal -
实验6 文件I/O与异常处理
实验任务1 代码 c++ 1 #pragma once 2 #include <iomanip> 3 #include <iostream> 4 #include <string> 5 6 struct Contestant { 7 long id; // 学号 8 std::string name