C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-21-2009, 03:53 PM   #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 04:02 PM.
Apiatan is offline   Reply With Quote
Old 03-21-2009, 04:18 PM   #2
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,814
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
tabstop is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 10:50 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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