当前位置:网站首页>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!");
}
}
}
边栏推荐
- Idea packages the web project into a war package and deploys it to the server to run
- Application of ncnn neural network computing framework in orange school orangepi 3 lts development board
- 社交社区论坛APP超高颜值UI界面
- 十條職場規則
- Social community forum app ultra-high appearance UI interface
- (latest version) WiFi distribution multi format + installation framework
- 剑指Offer03. 数组中重复的数字【简单】
- Detailed explanation of the most complete constraintlayout in history
- elastic_ L02_ install
- 并网-低电压穿越与孤岛并存分析
猜你喜欢
![[problem exploration and solution of one or more filters or listeners failing to start]](/img/82/e7730d289c4c1c4800b520c58d975a.jpg)
[problem exploration and solution of one or more filters or listeners failing to start]

【数据挖掘复习题】

ncnn神经网络计算框架在香橙派OrangePi 3 LTS开发板中的使用介绍

Day 1 of kotlin learning: simple built-in types of kotlin

社交社区论坛APP超高颜值UI界面

The latest version of blind box mall thinkphp+uniapp

剑指Offer07. 重建二叉树

【计网】第三章 数据链路层(2)流量控制与可靠传输、停止等待协议、后退N帧协议(GBN)、选择重传协议(SR)
![[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)

studio All flavors must now belong to a named flavor dimension. Learn more
随机推荐
Tianyi ty1208-z brush machine detailed tutorial (free to remove)
Solve the problem of VI opening files with ^m at the end
剑指Offer05. 替换空格
[judgment question] [short answer question] [Database Principle]
Cache penetration and bloom filter
Togaf certification self-study classic v2.0
Nodejs+Express+MySQL实现登陆功能(含验证码)
【习题六】【数据库原理】
[problem exploration and solution of one or more filters or listeners failing to start]
电压环对 PFC 系统性能影响分析
Ali & ant self developed IDE
Take you to the installation and simple use tutorial of the deveco studio compiler of harmonyos to create and run Hello world?
Glide 4.6.1 API initial
Everything comes to him who waits
Idea packages the web project into a war package and deploys it to the server to run
【習題七】【數據庫原理】
2021 autumn Information Security Experiment 1 (password and hiding technology)
Kotlin notes - popular knowledge points asterisk (*)
initial、inherit、unset、revert和all的区别
With pictures and texts, summarize the basic review of C language in detail, so that all kinds of knowledge points are clear at a glance?