当前位置:网站首页>C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
2022-07-03 12:52:00 【superfreak】
using System;
namespace Chapter15InterfaceSampleP271
{
class MyClass :IComparable// Class implementation reference
{
public int TheValue;
public int CompareTo(object obj)// Implementation method
{
MyClass mc=(MyClass)obj;
if (this.TheValue<mc.TheValue) return -1;
if (this.TheValue > mc.TheValue) return 1;
return 0;
}
}
class Program
{
static void PrintOut(string s, MyClass[] mc)
{
Console.Write(s);
foreach (var m in mc)
{
Console.Write("{0}、", m.TheValue);
}
Console.WriteLine("");
}
static void Main(string[] args)
{
var myInt = new[] { 20,4,16,9,2};
MyClass[] mcArr = new MyClass[5];
for (int i = 0; i < 5; i++)
{
mcArr[i] = new MyClass();
mcArr[i].TheValue = myInt[i];
}
PrintOut("Initial Order:",mcArr);
Array.Sort(mcArr);
PrintOut("Sorted Order:", mcArr);
Console.WriteLine("Hello World!");
}
}
}
边栏推荐
- Xctf mobile--app2 problem solving
- ImportError: No module named examples. tutorials. mnist
- Comprehensive evaluation of double chain notes · Siyuan notes: advantages, disadvantages and evaluation
- 双链笔记·思源笔记综合评测:优点、缺点、评价
- 最新版盲盒商城thinkphp+uniapp
- 【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)
- How to stand out quickly when you are new to the workplace?
- [exercise 7] [Database Principle]
- Everything comes to him who waits
- 如何在微信小程序中获取用户位置?
猜你喜欢

【ManageEngine】IP地址扫描的作用

剑指Offer09. 用两个栈实现队列

Xctf mobile--rememberother problem solving

Social community forum app ultra-high appearance UI interface

Solve the problem of VI opening files with ^m at the end
![[ManageEngine] the role of IP address scanning](/img/dc/df353da0e93e4d936c39a39493b508.png)
[ManageEngine] the role of IP address scanning
![[network counting] Chapter 3 data link layer (2) flow control and reliable transmission, stop waiting protocol, backward n frame protocol (GBN), selective retransmission protocol (SR)](/img/45/c2d7934b886d8090373ca9e6e23c97.gif)
[network counting] Chapter 3 data link layer (2) flow control and reliable transmission, stop waiting protocol, backward n frame protocol (GBN), selective retransmission protocol (SR)

Differences between initial, inherit, unset, revert and all

Application of ncnn Neural Network Computing Framework in Orange Pi 3 Lts Development Board

The upward and downward transformation of polymorphism
随机推荐
Sqoop1.4.4原生增量导入特性探秘
Everything comes to him who waits
Sword finger offer14 the easiest way to cut rope
4. 无线体内纳米网:电磁传播模型和传感器部署要点
启用MemCached的SASL认证
Public and private account sending prompt information (user microservice -- message microservice)
Nodejs+Express+MySQL实现登陆功能(含验证码)
[problem exploration and solution of one or more filters or listeners failing to start]
Enter the length of three sides of the triangle through the user, and calculate the area of the triangle, where the length is a real number
Huffman coding experiment report
[ArcGIS user defined script tool] vector file generates expanded rectangular face elements
[network counting] Chapter 3 data link layer (2) flow control and reliable transmission, stop waiting protocol, backward n frame protocol (GBN), selective retransmission protocol (SR)
How to convert a decimal number to binary in swift
The best shortcut is no shortcut
【数据库原理及应用教程(第4版|微课版)陈志泊】【第七章习题】
Attack and defense world mobile--ph0en1x-100
剑指Offer07. 重建二叉树
Apache Mina Development Manual
Eureka self protection
剑指Offer10- I. 斐波那契数列