Hi,

I know matrix 2d can be written like array[5][5] which saying 5x5 matrix but how do i make the row is like sequence of alphabets so its like array[a...z][5] while the column still numbers. Thanks.

drogba123 0 Junior Poster

Hi,

I know matrix 2d can be written like array[5][5] which saying 5x5 matrix but how do i make the row is like sequence of alphabets so its like array[a...z][5] while the column still numbers. Thanks.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

drogba123 0 Junior Poster

drogba123 0 Junior Poster

**[1] = 2. something like that. is there any method i can use?thanks.**

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

*are *numbers according to the ASCII/Unicode tables, eg 'a' is 97, so you can use chars to index into an array:

a[2] is valid and identical to a[97][2]

You can also use them in arthmetic, so, for example

char x = 'a';

a[x-'a'][2] is valid and identical to a[0][2]

char x = 'b';

a[x-'a'][2] is valid and identical to a[1][2]

etc.

(that was a hint!)

drogba123 0 Junior Poster

Hi,

Thanks for the hint. after i created the matrix, i need to do a uniform cost search on the array so it can find the best path from start to the end point. any idea or tips how i can start on implement the algorithm? thanks

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Sorry, I think you need a mathematician, not a humble coder for that.

drogba123 0 Junior Poster

or maybe use A* star search algorithm. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.