Advertisement
Glebzok

Histogramer.cpp

Oct 13th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <iomanip>
  4. #include <algorithm>
  5. #include "histogram.h"
  6.  
  7.  
  8.  
  9. int main(){
  10.     const char * const strProgramName = "Histogramer 1.0";
  11.  
  12.     std::cout << std::setfill('*') << std::setw(strlen(strProgramName)+4) << "" << std::endl;
  13.     std::cout << '*' << std::setfill(' ') << std::setw(strlen(strProgramName)+3) << '*' << std::endl;
  14.     std::cout << "* " << strProgramName << " *" << std::endl;
  15.     std::cout << '*' << std::setfill(' ') << std::setw(strlen(strProgramName)+3) << '*' << std::endl;
  16.     std::cout << std::setfill('*') << std::setw(strlen(strProgramName)+4) << "" << std::endl << std::endl;
  17.  
  18.     Histogram myBarChart;
  19.  
  20.     InitHistogram(myBarChart);
  21.     AddBlock(myBarChart, "aaa");
  22.     AddBlock(myBarChart, "a");
  23.     AddBlock(myBarChart, "aa");
  24.     AddBlock(myBarChart, "b");
  25.     AddBlock(myBarChart, "c");
  26.     AddBlock(myBarChart, "a");
  27.     AddBlock(myBarChart, "dddddddddddd");
  28.     AddBlock(myBarChart, "e");
  29.     AddBlock(myBarChart, "c");
  30.     AddBlock(myBarChart, "z");
  31.     AddBlock(myBarChart, "zzz");
  32.     AddBlock(myBarChart, "z");
  33.     AddBlock(myBarChart, "z");
  34.     AddBlock(myBarChart, "z");
  35.     AddBlock(myBarChart, "Y");
  36.     AddBlock(myBarChart, "Y");
  37.     AddBlock(myBarChart, "aa");
  38.     AddBlock(myBarChart, "aa");
  39.     AddBlock(myBarChart, "aa");
  40.     AddBlock(myBarChart, "aa");
  41.     PrintHistogram(myBarChart);
  42.    
  43.     std::cout << std::endl;
  44.     SortByVal(myBarChart);
  45.  
  46.  
  47.     PrintHistogram(myBarChart);
  48.     std::cout << std::endl;
  49.     SortByVal(myBarChart, false);
  50.     PrintHistogram(myBarChart);
  51.  
  52.     DestroyHistogram(myBarChart);
  53.     std::cout << std::endl;
  54.     char* str = "balaklava";
  55.    
  56.     stringHist(str);
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement