我爱学习网 52xx.cn我爱学习网菜单按钮
  • 搜索
当前位置:首页 > 专题 > 写作模板 > 笔试题目

C++编程实例

发布时间:2021-02-04 栏目:专题 投稿:舒适的月饼

C++编程实例

随机分配座位,共50个学生,使学号相邻的同学座位不能相邻(早些时候用c#写的,没有用c改写)。static void main(string args){int tmp = 0, count = 50;int seats = new int;bool students = new bool;system.random randstudent=new system.random();students=randstudent.next(0,count)]=true;for(int i = 1; i < count; ) {tmp=(int)randstudent.next(0,count);if((!students)&&(seats-tmp!=1) && (seats – tmp) != -1) {seats = tmp;students = true;}}foreach(int student in seats)system.console.write(student + ” “);system.console.read();}

相关推荐:

阿里巴巴2020秋招运营专员笔试经验

农行分行笔试题型

上海清算所项目经理笔试经验

南航笔试经验分享

乐易网络2020校招笔试经验