I need help to solve this problem . Am new and a starter , but well am tring my hand at it by practising.
Am working on making a 3 dimensional array using C#. I have 3 salers in a country (saler 1, 2, and 3.) Operating in 3 regional areas, region A, B, and C)and lastly commodities , cosmetics 70$ per each, books 10$, and vegetables 68$, ).
I would like to computer and report in 3 dimensional array of the activities in the three regions, thats
who sold what and how many different commodities plus totalprise of commodities , and then total sold per each salers , and if possible all total of commodities sold by all sales per each ragion.
But I Know and can do this the easy way by building a database in Microsoft Access and tabulate.
But I want to learn to do it from scrach using c# to the console application. Can you help me.
This is what iI did so far , but my having haedache, cos its not working for me. I know its confusing but I hope you get my idaes of the question. The data types are also confusing for me cos the rule that elements must be of the same date type makes it even more diffcult , so type casting has to be applied somewhere but where and how.
please help me with a sample code. so i can use as a template.
My code;

using System;
using System.Collections.Generic;
using System.Text;

namespace 3DimensionArray
   class Program
      static void Main(string[] args)

         double[][][] sales = new double[3][3][3];

         for (int i =1; i <= double.Length; i++)
            enter region = O;
            enter commodities = 2;
            enter saler = 1;
            prise = 500$;

            saler[r][c][s]= new saler [r][c][s] + pris;




Recommended Answers

All 8 Replies

3D array in C# is double[ , , ] sales; Read in arrays in C#

enter region = O;
enter commodities = 2;
enter saler = 1;
prise = 500$;

What does this code even mean? It is not C#.

please ras.fol

i know this is not c#. like i said am trying myhand at it, please if you cant help me say so , rather than playing smart on me.
that answer of yours is in no way helpful ,but discouraging.

Did you read mine?

yes ramy
i have read yours and am trying my almost to work it out.

this is not a homework, its my own work to manage my office , i use access, i just want to try C# as a hobby, thats why i came here.
thanks anyway

Rashakil was just making a point here. You seem a bit desperate. Never be desperate when you want to be a programmer.
Why use a 3D array? Have you considered an array of class or struct for your "Saler"(I think you mean salesman)
In a class or struct you could store all the fields you want ( in connection with your saler) in any type you see fit.

no, thats helps me to the end of the tunnel, i can see the light at the end . i have to use a class for my salesmanarray, thanks

instead of using 3 dimentional array, use two datatable objects and set a relation between them using a dataset object. relational database model is what you need, you dont need to bother with arrays.

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.