C 语言课程设计报告 第 6 页,共 31 页
模块三:show()
void show(){
cout<<"Solution: "<
C 语言课程设计报告 第 7 页,共 31 页
2. 因为要打印出所有排班情况,所以需要回溯!即 dfs(person+1);后 rest[person][j]=1;。
模块五:main()
int main()
{
memset(rest,0,sizeof(rest));
cout<<"注意!每次输入完“、”后请输入空格再继续输入!"<
#include
开始DFS(person)person==7结束DFS打印排班信息Yj=0rest[person][j]==1&&judge(person,j)rest[person][j]=8DFS(person+1)rest[person][j]=1j++j<7YNYNNhttps://blog.csdn.net/weixin_45953673
C 语言课程设计报告 第 8 页,共 31 页
#include
#include
using namespace std;
int n;
int rest[7][7];
string choice;
char week[7][10]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
char weekkk[7][15]={"星期日、","星期一、","星期二、","星期三、","星期四、","星期五、","星期六、
"};
char people[7][5]={"赵","钱","孙","李","周","吴","陈"};
void distinguish(){
for(int i=0;i<7;++i){
cout<>choice;
for(int k=0;k<7;++k){
if(choice==weekkk[k]){
rest[i][k]=1;
choice="";
break;
}
}
if(choice=="") continue;
for(int k=0;k<7;++k){
if(choice==week[k]){
rest[i][k]=1;
choice="";
https://blog.csdn.net/weixin_45953673