Advertisement
Guest User

Untitled

a guest
Sep 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <fstream>
  4. #include <Windows.h>
  5. #include <string>
  6. #include <vector>
  7. #include <iostream>
  8. #include <Windows.h>
  9. #include <atlstr.h>
  10. #include <iostream>
  11. #include <sstream>
  12.  
  13. using namespace std;
  14.  
  15. int main(int argc, const char * argv[])
  16. {
  17.     vector<string> szakirodalom;
  18.     string tmp;
  19.     string currentDate;
  20.     vector<string> v;
  21.     setlocale(LC_ALL, "hun");
  22.     string  array[4];
  23.     SYSTEMTIME time;
  24.     GetLocalTime(&time);
  25.    
  26.     cout << "Részfeladat megnevezése: ";
  27.     getline(cin, array[0]);
  28.     cout << endl;
  29.     cout << "Elvégzett munka rövid leírása: ";
  30.     getline(cin, array[1]);
  31.     cout << endl;
  32.     cout << "Tapasztalatok: ";
  33.     getline(cin, array[2]);
  34.     cout << endl;
  35.     do {
  36.         tmp = "";
  37.         cout << "Felhasznált irodalom: ";
  38.         getline(cin, tmp);
  39.         if (tmp != "")
  40.         {
  41.             szakirodalom.push_back("<a target=\"_blank\" href=\"");
  42.             szakirodalom.push_back(tmp);
  43.             szakirodalom.push_back("\">");
  44.             szakirodalom.push_back(tmp);
  45.             szakirodalom.push_back("</a> ");
  46.         }
  47.         cout << endl;
  48.     } while (tmp!="");
  49.     tmp = "";
  50.     for (int i=0;i<szakirodalom.size();i++)
  51.     {
  52.         tmp += szakirodalom[i];
  53.     }
  54.  
  55.     array[3] = tmp;
  56.    
  57.     ifstream file("C:\\Users\\louvre\\Documents\\GitHub\\lorincm.github.io\\munka.html");
  58.    
  59.     CString cstrMessage;
  60.  
  61.     cstrMessage.Format("%d-%02d-%02d",
  62.         time.wYear,
  63.         time.wMonth,
  64.         time.wDay
  65.     );
  66.  
  67.     currentDate = cstrMessage;
  68.  
  69.  
  70.     string currentline;
  71.  
  72.     while (!file.eof())
  73.     {
  74.         getline(file, currentline);
  75.        
  76.         if (currentline == "<!---->")
  77.         {
  78.             v.push_back("<table> <tr><th>Dátum</th><th>A részfeladat megnevezése</th><th>Elvégzett munka rövid leírása</th><th>Tapasztalatok</th><th>Igénybe vett szakirodalom</th></tr><tr><td>");
  79.             v.push_back(currentDate);
  80.             v.push_back("</td><td>");
  81.             v.push_back(array[0]);
  82.             v.push_back("</td><td>");
  83.             v.push_back(array[1]);
  84.             v.push_back("</td><td>");
  85.             v.push_back(array[2]);
  86.             v.push_back("</td><td> ");
  87.             v.push_back(array[3]);
  88.             v.push_back("</td><td> </table>");
  89.             v.push_back("<!---->");
  90.         }
  91.         else
  92.         {
  93.             v.push_back(currentline);
  94.         }
  95.     }
  96.     file.close();
  97.     ofstream asd("C:\\Users\\louvre\\Documents\\GitHub\\lorincm.github.io\\munka.html");
  98.     asd.clear();
  99.  
  100.     for (int i=0;i<v.size();i++)
  101.     {
  102.         if (v[i] == "<!---->")
  103.         {
  104.             asd << endl;
  105.             asd << v[i] << endl;
  106.         }
  107.         else
  108.         {
  109.             asd << v[i];
  110.         }
  111.            
  112.     }
  113.     return 0;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement