Skip to content

Commit 6477df1

Browse files
committed
format output
1 parent bc100bc commit 6477df1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/pascalTriangle/pascalTriangle.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,25 @@ vector<vector<int> > generate(int numRows)
4646

4747
void printVector(vector< vector<int> > pt)
4848
{
49+
cout << "[" << endl;
4950
for(int i=0; i<pt.size(); i++){
50-
cout << "{ ";
51+
for(int space=(pt.size()-i-1); space>=0; space--){
52+
cout << " ";
53+
}
54+
cout << "[";
5155
for(int j=0; j<pt[i].size(); j++){
52-
cout << pt[i][j] << ", ";
56+
cout << pt[i][j];
57+
if(j<pt[i].size()-1){
58+
cout << ",";
59+
}
60+
}
61+
cout << "]";
62+
if(i<pt.size()-1){
63+
cout << ",";
5364
}
54-
cout << "} " << endl;
65+
cout << endl;
5566
}
67+
cout << "]" << endl;
5668
}
5769

5870
int main(int argc, char** argv)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy