-
+
成熟大叔
温柔淑女
甜美少女
清亮青叔
呆萌萝莉
靓丽御姐
C++编程实例
随机分配座位,共50个学生,使学号相邻的同学座位不能相邻(早些时候用c#写的,没有用c改写)。
static void main(string[] args)
{
int tmp = 0, count = 50;
int[] seats = new int[count];
bool[] students = new bool[count];
system.random randstudent=new system.random();
students[seats[0]=randstudent.next(0,count)]=true;
for(int i = 1; i < count; ) {
tmp=(int)randstudent.next(0,count);
if((!students[tmp])&&(seats[i-1]-tmp!=1) && (seats[i-1] – tmp) != -1) {
seats[i++] = tmp;
students[tmp] = true;
}
}
foreach(int student in seats)
system.console.write(student + ” “);
system.console.read();
}
【C++编程实例】相关文章:
个人简历的定义及格式2025-07-25
求职简历的基本格式及写作指导2025-07-25
个人简历的一般规格和要求2025-07-25
优秀简历的版式2025-07-25
毕业生求职简历格式模板2025-07-25
日本式简历书写方法2025-07-25
规范的个人简历格式2025-07-25
HR最爱的简历风格2025-07-25
如何做到简历格式的简洁明了2025-07-25
简历格式:简历的组成要素2025-07-25
