-
Notifications
You must be signed in to change notification settings - Fork 1
/
Spreadsheet_2d.cpp
48 lines (39 loc) · 944 Bytes
/
Spreadsheet_2d.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Cell
{
string text;
int number;
// Will add in more.. float, double etc.
};
void print (const vector<vector<Cell>>& Spreadsheet)
{
for (const auto & row : Spreadsheet)
{
for (const auto & cell : row)
{
cout << cell.number << ' ';
}
cout << '\n';
}
}
void init(vector<vector<Cell>>& Spreadsheet)
{
for (size_t i=0; i<Spreadsheet.size(); i++)
{
for (size_t j=0; j<Spreadsheet[i].size() ; j++)
{
Spreadsheet[i][j].number = 7;
}
}
}
int main()
{
const int Spreadsheet_Width = 53;
const int Spreadsheet_Height = 76;
vector<vector<Cell>> Spreadsheet(Spreadsheet_Height, vector<Cell>(Spreadsheet_Width));
init(Spreadsheet);
print(Spreadsheet);
}