The aim of project is create application, that will implement basic operations of table processors. Input for application will be text data (to stdin). Commands will be set by arguments in command line. For output use standard output (stdout).
Use makefile. That is easiest way:
make
Alternatively you can compile it on your own:
gcc -std=c99 -Wall -Wextra -Werror -pedantic -c -o sheet.o sheet.c
./sheet [-d delimiter] [table editing commands]
or:
./sheet [-d delimiter] [selection commands] [data processing commands]
Argument -d
defines what characters could be interpreted as columns delimiters.
In case delimtier is not set, delimiter is space
.
First delimiter from delimiters will be used as delimiter for output data.
Commands that changes table dimension.
irow R
- adds new row with empty cells before rowR
(R
> 0)arow
- adds new row with empty cells at the end of tabledrow R
- deletes rowR
(R
> 0)icol C
- adds empty column before the columnC
acol
- adds empty column behind last columndcol C
- deletes columnC
dcols N M
- deletes columnsN
toM
, includingM
andN
.
Commands that process data in table.
cset C STR
- to cellC
sets stringSTR
tolower C
- string in columnC
converts to lowercasetoupper C
- string in columnC
converts to uppercaseround C
- rounds number in columnC
int C
- removes decimal part of number in columnC
copy N M
- replaces value in columnM
with value from columnN
swap N M
- swaps value of columnN
with value of columnM
csum C N M
- to cell in columnC
sets sum of cellsN
toM
(including)cavg C N M
- same as csum, but to columnC
sets average of cellsN
toM
cmin C N M
- same as csum, but to columnC
sets the smallest value of cellsN
toM
cmax C N M
- same as csum, but to columnC
sets the biggest value of cellsN
toM
ccount C N M
- same as csum, but to columnC
sets count of not empty cells in rangeN
toM
cseq N M B
- to cellsN
toM
sets increasing numbers starting at numberB
Commands that selects range of rows to be processed.
rows N M
- selects rowsN
toM
including.- Rows from row
N
to end of table could be represented asrows N -
- Last row only could be represented as
rows - -
- Rows from row
beginswith C STR
- selects rows, where columnC
starts with stringSTR
contains C STR
- selects rows, where columnC
contains stringSTR
split C STR
- splits cellC
by stringSTR
into more cells. ColumnsC+1, C+2, ...
should be moved to the right.- How would you handle various count of cells in different rows? - I am just unifying count of cells in whole table to make table valid.
10/10 + 2.9 premium points