C++编程实例

复制全文
下载全文
APP客户端
分享到:
关闭
AI朗读 - C++编程实例
00:00 / 00:00

-

+

语速: 慢速 默认 快速
- 8 +
自动播放×

成熟大叔

温柔淑女

甜美少女

清亮青叔

呆萌萝莉

靓丽御姐

温馨提示:
是否自动播放到下一条内容?
立即播放当前内容?
确定
确定
取消

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();

  }

Tags标签
C++编程实例 网络收集
浏览(109)次  /  简历模板
收藏
推荐(96)
要加油(9)
pre
play
next
close

留学网申各个环节的必须注意

HR对一些求职简历是被拒看的

网海求职如何获取成功?

1评论

网申:好的的公司必须具备六种特征

1评论
2评论

零工作经验毕业生网申求职误区

1评论
2评论
发表评论
内容:
剩余字数:360/360
每页10条,共0
随机欣赏
随便挑,随机选,总有无视的~.~
分类 换一批
职场文书书信函件祝福寄语演讲致词实用文档优秀作文工作报告小学作文贺词
<<
X