-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint.cpp
49 lines (40 loc) · 1.39 KB
/
print.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
49
#include <iostream>
#include <iomanip>
#include "headers/print.h"
using namespace std;
void array_print(int *arr, int size, const char* title)
/*
Print the array with a title
Input:
*arr - is the array which we want to print
size - is the size of the array
title - is the title we want to give went printning the array
Output:
void
*/
{
cout<<title;
for (int i = 0; i < size; i++) {
cout<<arr[i]<<" ";
}
cout<<endl;
}
void time_print(int size, char* sort, chrono::duration<double> time) {
cout<<"Size of data is "<<size<<" and using "<<sort<<" it took "<<time.count()<<"s. to sort that array."<<endl;
}
void all_algorytms_print(char **name_array, int data, double *time_array, int rows) {
char* row = (char*)"+----------------+-------------+-------------+";
char* names = (char*)"| Name | Data | Time |";
cout<<"Warning!"<<endl<<"Assumtion: You have data * "<<rows<<" numbers in the input file."<<endl;
cout<<row<<endl<<names<<endl<<row<<endl;
for (int i=0; i<rows; i++) {
cout<<"| "<<setw(14)<<left<<name_array[i]<<" | "<<setw(11)<<right<<data<<" | "<<setw(11)<<time_array[i]<<" |"<<endl;
cout<<row<<endl;
}
}
void progress_print(int done, int todo) {
if (done >= todo) return;
int proDone = ((double)done/todo)*100;
cout<<proDone<<"% \r";
cout.flush();
}