forked from haarcuba/cpp-text-table
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
42 lines (32 loc) · 725 Bytes
/
example.cpp
File metadata and controls
42 lines (32 loc) · 725 Bytes
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
#include <iostream>
#include "TextTable.h"
main()
{
TextTable t( '-', '|', '+' );
t.add( "" );
t.add( "Sex", TextTable::Alignment::CENTER);
t.add( "Age", TextTable::Alignment::CENTER );
t.endOfRow();
t.add( "Moses" );
t.add( "male" );
t.add( "4556" );
t.endOfRow();
t.add( "Jesus" );
t.add( "male" );
t.add( "2016" );
t.endOfRow();
t.add( "Debora" );
t.add( "female" );
t.add( "female" );
t.endOfRow();
t.add( "Bob" );
t.add( "male" );
t.add( "25" );
t.endOfRow();
t.setMinWidth(0, 10);
t.setMinWidth(1, 8);
t.setAlignment( 2, TextTable::Alignment::RIGHT );
t.setMinWidth(2, 8);
std::cout << t;
return 0;
}