多维数组中的混合类型 [英] Mixed types in multidimensional arrays

查看:62
本文介绍了多维数组中的混合类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何对数组进行这样的维度:


dim info(a为整数,b为字符串)所以我可以存储像

{{" John",10} {" Dan",20} {" Jane",30}}


我希望能够对这个数组进行排序,但我想我可以解决这个问题,如果我知道如何创建这个数组或者其他任何需要的方法。

-

Anil Gupte
www.keeninc.net
< a rel =nofollowhref =http://www.icinema.comtarget =_ blank> www.icinema.com

解决方案

公共结构存储

将整数调整为整数

将b调暗为字符串

结束结构


Dim info()as Storage


Anil Gupte写道:


如何对这样的数组进行维度:


昏暗信息(一个整数,b一个字符串)所以我可以存储一些东西喜欢

{{" John",10} {" Dan",20} {" Jane",30}}


我想要能够对这个数组进行排序,但我想我可以解决这个问题,如果我知道如何创建这个数组或者需要什么方法。


对不起,一定是:


公共结构存储

Dim a作为整数

Dim b As String

结束结构


Dim Info()as storage


Theo Verweij写道:


Public struct Storage

Dim a as Integer

Dim b as String

End Struct


Dim info()as Storage


Anil Gupte写道:
< blockquote class =post_quotes>
>我如何对这样的数组进行尺寸标注:

dim info(a为整数,b为字符串)所以我可以存储像
{{" John",10} {" Dan",20} {" Jane",30}}

我希望能够对此数组进行排序,但我想我如果我知道如何创建这个数组或其他任何需要的方法,那就可以摆动它。


在这种情况下,我可以创建一个类,对吧?我理解

结构是过去在OOP?


唯一的问题是,创建一个类阵列听起来令人生畏....


-

Anil Gupte
www.keeninc.net
< a rel =nofollowhref =http://www.icinema.comtarget =_ blank> www.icinema.com


Theo Verweij ; < tv ****** @ xs4all.nlwrote in message

新闻:OT **************** @ TK2MSFTNGP04.phx.gbl .. 。


对不起,它必须是:


公共结构存储

Dim a As Integer

Dim b As String

结束结构


Dim Info()as storage


Theo Verweij写道:


>公共结构存储
将a调暗为整数
将d b视为字符串
结束结构

昏暗的信息()作为存储

Anil Gupte写道:


>>我如何标注像这样的数组:

昏暗的信息(一个整数,b作为字符串)所以我可以存储像
{{" John",10} {" Dan",20}这样的东西{" Jane",30}}

我希望能够对这个数组进行排序,但我想如果我知道如何创建这个数组或其他什么我可以摆动它方法是必要的。




How can I dimension an array like this:

dim info(a as integer, b as string) so I can store somthing like
{{"John", 10}{"Dan", 20}{"Jane", 30}}

I want to be able to sort this array too, but I think I can swing that if I
know how to create this array or whatever else method is needed.
--
Anil Gupte
www.keeninc.net
www.icinema.com

解决方案

Public struct Storage
Dim a as Integer
Dim b as String
End Struct

Dim info() as Storage

Anil Gupte wrote:

How can I dimension an array like this:

dim info(a as integer, b as string) so I can store somthing like
{{"John", 10}{"Dan", 20}{"Jane", 30}}

I want to be able to sort this array too, but I think I can swing that if I
know how to create this array or whatever else method is needed.


Sorry, it must be:

Public structure Storage
Dim a As Integer
Dim b As String
End Structure

Dim Info() as storage

Theo Verweij wrote:

Public struct Storage
Dim a as Integer
Dim b as String
End Struct

Dim info() as Storage

Anil Gupte wrote:

>How can I dimension an array like this:

dim info(a as integer, b as string) so I can store somthing like
{{"John", 10}{"Dan", 20}{"Jane", 30}}

I want to be able to sort this array too, but I think I can swing that
if I know how to create this array or whatever else method is needed.


In that case, I may as well as create a class, right? I understand
Structures are "passe" in OOP?

Only problem is, creating a class that is an array sounds daunting....

--
Anil Gupte
www.keeninc.net
www.icinema.com

"Theo Verweij" <tv******@xs4all.nlwrote in message
news:OT****************@TK2MSFTNGP04.phx.gbl...

Sorry, it must be:

Public structure Storage
Dim a As Integer
Dim b As String
End Structure

Dim Info() as storage

Theo Verweij wrote:

>Public struct Storage
Dim a as Integer
Dim b as String
End Struct

Dim info() as Storage

Anil Gupte wrote:

>>How can I dimension an array like this:

dim info(a as integer, b as string) so I can store somthing like
{{"John", 10}{"Dan", 20}{"Jane", 30}}

I want to be able to sort this array too, but I think I can swing that
if I know how to create this array or whatever else method is needed.



这篇关于多维数组中的混合类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆