using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions; namespace c编程练习题
{ class Program
{
public struct student //结构体的用法。
{
public int code;
public string name;
public int old;
}
static void Main(string[] args)
{
Console.WriteLine("请输入学生的人数");
int count = int.Parse(Console.ReadLine());
ArrayList arr=new ArrayList();
for (int i = ; i < count; i++)
{ student s = new student();
Console.WriteLine("学号:");
s.code = int.Parse(Console.ReadLine());
Console.WriteLine("姓名:");
s.name = Console.ReadLine();
Console.WriteLine("年龄:");
s.old = int.Parse(Console.ReadLine());
arr.Add(s);
}
for (int i = ; i <count; i++)
{
for (int j = i+; j < count ; j++)
{
if (((student)arr[i]).old<((student)arr[j]).old)
{
student temp = (student)arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
Console.WriteLine("学号 姓名 年龄 从大到小依次排列");
foreach (student s in arr)
{
Console.Write("{0} {1} {2}\n",s.code,s.name,s.old);
}
Console.ReadLine(); }
}
}

最新文章

  1. 微信支付JSAPI模式及退款CodeIgniter集成篇
  2. ThinkPHP报错处理
  3. Qt 按键长按的处理
  4. 判断线段相交 -- 51nod 1264 线段相交
  5. 初识io流条件状态
  6. 《Python基础教程(第二版)》学习笔记 -&gt; 第九章 魔法方法、属性和迭代器
  7. C#中委托和事件的区别实例解析
  8. 关于DJANGO和JAVASCRIPT的时间
  9. android119 侧滑菜单
  10. Qapp使用总结
  11. 高放的c++学习笔记之类
  12. Node.js log1: ERR can not find module express
  13. atitit.为什么技术的选择方法java超过.net有前途
  14. Linux环境进程间通信(一):管道及命名管道
  15. 解决Chrome动画”卡顿”的办法
  16. 苹果ATS特性服务器证书配置指南
  17. rapidPHP 下载并安装
  18. SpringBoot 统一时区的方案
  19. FastCGI sent in stderr: &quot;PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, &#39;&amp;lt;&#39; not found in
  20. chmod a+r file:给所有用户添加读的权限

热门文章

  1. 研:手势与眼动相结合-手势SDK的整合
  2. C语言 后缀自增的优先级详解
  3. 获取元素的xpath, 转换xpath为csspath进行jQuery元素获取
  4. [CareerCup] 8.9 An In-memory File System 内存文件系统
  5. 【iOS功能实现】之利用UIDocumentInteractionController打开和预览文档
  6. Chrome扩展开发(Gmail附件管理助手)系列之〇——概述
  7. 成都普华永道税务开发的offer
  8. JAVA并发的性能调整
  9. 项目笔记---Windows Service调用Windows API问题
  10. 每天一个linux命令(47):traceroute命令