Creating a Spreadsheet using a multidimensional array

This is a discussion on Creating a Spreadsheet using a multidimensional array within the C++ Programming forums, part of the General Programming Boards category; I am having trouble with a program, I really don't know how to start. I have to create a simple ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    1

    Creating a Spreadsheet using a multidimensional array

    I am having trouble with a program, I really don't know how to start. I have to create a simple spreadsheet program that can set values to cells like A1 = 24, and can do operations and put the value of the operations into a cell like C3= A1+2.
    The program pretty much calls for the person to make a spread sheet like in excel.
    The main problems I have with it is I dunno how write the proper input so I can access certain cells of the array and put information into them, I don't want the program code written so much as I want a basic example on how to take a two dimensional array and be able to access the the elements of the array in program and change the values within those elements so I can type in on the cosole "A1= 3" and have the array element that has A1 in it be changed to 3
    Last edited by Apiatan; 03-21-2009 at 05:02 PM.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    So that's several subproblems to work on (and working on subproblems is good, since you can solve one subproblem without worrying about the others at all):
    1) Getting input
    2) Deciding, given a string, what to do about it (is it an assignment, or a formula, or what)
    3) Given a cell reference, how to determine what cell it refers to
    4) How to store a formula in your array

    Using a two-dimensional array is dead simple: you give the row index and the column index and you're done.
    Code:
    int two_d_array[100][100];
    two_d_array[5][8] = 4; //set the element in the sixth row and ninth column to 4

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 10:38 AM
  2. Creating array of structs
    By knirirr in forum C++ Programming
    Replies: 12
    Last Post: 06-18-2008, 09:30 AM
  3. Creating a menu that reads input via an array?
    By Nalif in forum C Programming
    Replies: 6
    Last Post: 09-29-2006, 10:21 PM
  4. Creating array from data file...
    By Crankit211 in forum C Programming
    Replies: 2
    Last Post: 12-06-2001, 09:45 PM
  5. Creating an array of object pointers
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-08-2001, 11:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21