Hey!

I am college student training for exam. Found one problem and I know you'll know what to use straight away. Here we go:

We got a file where the excel sheet is encrypted like this:

1;2;3;=A2
;;1;4;5
;=580*A;=D2+1

Formulas are just simple ones, max. two numbers and *, /, +, -.

Output should be: all formulas solved or message about cycle.

How would you represent the data? I guess it won't be <vector>. Would that be <map> or simple array of pointers on struct

{bool solved; int number; string formula}

?

Thanks for your opinion.

With some simple representation of 'cell', your spreadsheet could just use a map<pair<int,int>, cell>. Or even (for usability) map<pair<char,int>, cell>.

On top of that, or as a modification of that, you might want some algorithm-specific information, like, maybe you want to store the indegree of each cell in the map, or inside a parallel map.

With some simple representation of 'cell', your spreadsheet could just use a map<pair<int,int>, cell>. Or even (for usability) map<pair<char,int>, cell>.

On top of that, or as a modification of that, you might want some algorithm-specific information, like, maybe you want to store the indegree of each cell in the map, or inside a parallel map.

WOW! Seems interesting. Gonna try it. 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.