Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <cstring>
  5. #include <cstdlib>
  6. #define Row 8
  7. #define Column 10
  8.  
  9. using namespace std;
  10.  
  11. string FileName = "Null", excel[Column * Row], Text, Space, Token, Saveas, CopyExcel[10], Temp[10], UndoTile[80], UnCE[10], temp[8], SaveFile, Line, Savedata, LoadName, LoadTile[80];
  12. int WordLength, TileNum, DelTile1, DelTile2, CopyTile1, CopyTile2, FileAmount = 0, Largest, TempNum;
  13. char Choice;
  14. void Choose(), Menu(), New(), Insert(), Delete(), Overwrite(), Load(), Save(), Copy(), Clipboard(), Cut(), Paste(), Find(), Undo(), BeforeUndo();
  15.  
  16. int main()
  17. {
  18.     cout << "*============================================" << endl << endl;
  19.     cout << "File Name : Null" << endl << endl;
  20.     Choose();
  21.     for (int i = 0; i < 80; i++) //put all " " element in array
  22.     {
  23.         excel[i] = " ";
  24.     }
  25.     Insert();
  26.     system("pause");
  27.     return 0;
  28. }
  29.  
  30. void Choose()
  31. {
  32.     cout << "[N]ew, [I}nsert, [D]elete, [O]verwrite, [L]oad, [S]save," << endl
  33.         << "[C]opy, show - clip[B]oard, [X]cut, [P]aste, [F]ind, [U]ndo, [E]nd" << endl
  34.         << "==>";
  35.     cin >> Choice;
  36.     char convert = (toupper(Choice)); //convert lowercase to uppercase
  37.     while (cin.fail()) //avoid error input
  38.     {
  39.         cin.clear();
  40.         cin.ignore();
  41.         cout << "Invalid input, please enter again." << endl << endl
  42.             << "*============================================"
  43.             << endl << endl
  44.             << "[N]ew, [I}nsert, [D]elete, [O]verwrite, [L]oad, [S]save," << endl
  45.             << "[C]opy, show - clip[B]oard, [X]cut, [P]aste, [F]ind, [U]ndo, [E]nd " << endl
  46.             << "==>";
  47.         cin >> Choice;
  48.     }
  49.  
  50.     switch (convert)
  51.     {
  52.     case 'N':
  53.         New();
  54.         Choose();
  55.         break;
  56.  
  57.     case 'I':
  58.         if (FileName == "Null")
  59.         {
  60.             cout << "Please create a new file first." << endl;
  61.             Choose();
  62.         }
  63.         BeforeUndo();
  64.         Insert();
  65.         Menu();
  66.         Choose();
  67.         break;
  68.  
  69.     case 'D':
  70.         if (FileName == "Null")
  71.         {
  72.             cout << "Please create a new file first." << endl;
  73.             Choose();
  74.         }
  75.         BeforeUndo();
  76.         Delete();
  77.         Menu();
  78.         Choose();
  79.         break;
  80.  
  81.     case 'O':
  82.         if (FileName == "Null")
  83.         {
  84.             cout << "Please create a new file first." << endl;
  85.             Choose();
  86.         }
  87.         BeforeUndo();
  88.         Overwrite();
  89.         Menu();
  90.         Choose();
  91.         break;
  92.  
  93.     case 'C':
  94.         if (FileName == "Null")
  95.         {
  96.             cout << "Please create a new file first." << endl;
  97.             Choose();
  98.         }
  99.         BeforeUndo();
  100.         Copy();
  101.         Menu();
  102.         Choose();
  103.         break;
  104.        
  105.     case 'B':
  106.         if (FileName == "Null")
  107.         {
  108.             cout << "Please create a new file first." << endl;
  109.             Choose();
  110.         }
  111.         Clipboard();
  112.         Choose();
  113.         break;
  114.        
  115.     case 'X':
  116.         if (FileName == "Null")
  117.         {
  118.             cout << "Please create a new file first." << endl;
  119.             Choose();
  120.         }
  121.         BeforeUndo();
  122.         Cut();
  123.         Menu();
  124.         Choose();
  125.         break;
  126.        
  127.     case 'P':
  128.         if (FileName == "Null")
  129.         {
  130.             cout << "Please create a new file first." << endl;
  131.             Choose();
  132.         }
  133.         BeforeUndo();
  134.         Paste();
  135.         Menu();
  136.         Choose();
  137.         break;
  138.        
  139.     case 'F':
  140.         if (FileName == "Null")
  141.         {
  142.             cout << "Please create a new file first." << endl;
  143.             Choose();
  144.         }
  145.         Find();
  146.         Menu();
  147.         Choose();
  148.         break;
  149.        
  150.     case 'U':
  151.         if (FileName == "Null")
  152.         {
  153.             cout << "Please create a new file first." << endl;
  154.             Choose();
  155.         }
  156.         Undo();
  157.         Menu();
  158.         Choose();
  159.         break;
  160.        
  161.     case 'S':
  162.         if (FileName == "Null")
  163.         {
  164.             cout << "Please create a new file first." << endl;
  165.             Choose();
  166.         }
  167.         Save();
  168.         Menu();
  169.         Choose();
  170.         break;
  171.  
  172.     case 'L':
  173.         if (FileName == "Null")
  174.         {
  175.             cout << "Please create a new file first." << endl;
  176.             Choose();
  177.         }
  178.         Load();
  179.         Menu();
  180.         Choose();
  181.         break;
  182.                
  183.     case 'E':
  184.         exit(0);
  185.         break;
  186.  
  187.     default:
  188.         cout << "Enter again." << endl;
  189.         Choose();
  190.     }
  191. }
  192.  
  193. void Menu()
  194. {
  195.     for (int j = 0; j < 8; j++)
  196.     {
  197.         TempNum = 0;
  198.         for (int i = j; i< 80; i+=8)
  199.         {
  200.             Largest = excel[i].length();
  201.             if (Largest >= TempNum)
  202.             {
  203.                 temp[j] = excel[i];
  204.                 TempNum = Largest;
  205.             }
  206.            
  207.         }
  208.     }
  209.  
  210.     cout << endl << "------------------------ new screen ------------------------" << endl;
  211.     cout << endl << "File Name: " << FileName << endl;
  212.     cout << "|----"; //1st line
  213.  
  214.     for (int i = 0; i < 8;i++)
  215.     {
  216.         WordLength = temp[i].length();
  217.         if (WordLength == 0)
  218.         {
  219.             WordLength = 1;
  220.         }
  221.         cout << "+" << string(WordLength+2, '-');
  222.     }
  223.     cout << "|" << endl;
  224.  
  225.     cout << "|    |";//2nd line
  226.     for (int i = 0; i < 8; i++)
  227.     {
  228.         WordLength = temp[i].length();
  229.         if (WordLength == 0)
  230.         {
  231.             WordLength = 1;
  232.         }
  233.         cout << " " << i + 1 << string(WordLength, ' ') << "|";
  234.     }
  235.  
  236.     cout << endl << "|----";//3rd line
  237.     for (int i = 0; i < 8; i++)
  238.     {
  239.         WordLength = temp[i].length();
  240.         if (WordLength == 0)
  241.         {
  242.             WordLength = 1;
  243.         }
  244.         cout << "+" << string(WordLength + 2, '-');
  245.     }
  246.     cout << "|";
  247.  
  248.     cout << endl << "| 00 |";//4th line
  249.     for (int i = 0; i < 8; i++)
  250.     {
  251.         int Longest = temp[i].length();
  252.         int Short = excel[i].length();
  253.         if (excel[i] == "")
  254.         {
  255.             excel[i] = " ";
  256.         }
  257.         WordLength = Longest - Short +1;
  258.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  259.     }
  260.  
  261.     cout << endl << "|----";//5th line
  262.     for (int i = 0; i < 8; i++)
  263.     {
  264.         WordLength = temp[i].length();
  265.         if (WordLength == 0)
  266.         {
  267.             WordLength = 1;
  268.         }
  269.         cout << "+" << string(WordLength + 2, '-');
  270.     }
  271.     cout << "|";
  272.  
  273.     cout << endl << "| 08 |";//6th line
  274.     int j = 0;
  275.     for (int i = 8; i < 16; i++)
  276.     {
  277.         int Longest = temp[j].length();
  278.         j++;
  279.         int Short = excel[i].length();
  280.         if (excel[i] == "")
  281.         {
  282.             excel[i] = " ";
  283.         }
  284.         WordLength = Longest - Short +1;
  285.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  286.     }
  287.  
  288.     cout << endl << "|----";//7th line
  289.     for (int i = 0; i < 8; i++)
  290.     {
  291.         WordLength = temp[i].length();
  292.         if (WordLength == 0)
  293.         {
  294.             WordLength = 1;
  295.         }
  296.         cout << "+" << string(WordLength + 2, '-');
  297.     }
  298.     cout << "|";
  299.  
  300.     cout << endl << "| 16 |";//8th line
  301.     int a = 0;
  302.     for (int i = 16; i < 24; i++)
  303.     {
  304.         int Longest = temp[a].length();
  305.         a++;
  306.         int Short = excel[i].length();
  307.         if (excel[i] == "")
  308.         {
  309.             excel[i] = " ";
  310.         }
  311.         WordLength = Longest - Short +1;
  312.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  313.     }
  314.  
  315.     cout << endl << "|----";//9th line
  316.     for (int i = 0; i < 8; i++)
  317.     {
  318.         WordLength = temp[i].length();
  319.         if (WordLength == 0)
  320.         {
  321.             WordLength = 1;
  322.         }
  323.         cout << "+" << string(WordLength + 2, '-');
  324.     }
  325.     cout << "|";
  326.  
  327.     cout << endl << "| 24 |";//10th line
  328.     int b = 0;
  329.     for (int i = 24; i < 32; i++)
  330.     {
  331.         int Longest = temp[b].length();
  332.         b++;
  333.         int Short = excel[i].length();
  334.         if (excel[i] == "")
  335.         {
  336.             excel[i] = " ";
  337.         }
  338.         WordLength = Longest - Short +1;
  339.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  340.     }
  341.  
  342.     cout << endl << "|----";//11th line
  343.     for (int i = 0; i < 8; i++)
  344.     {
  345.         WordLength = temp[i].length();
  346.         if (WordLength == 0)
  347.         {
  348.             WordLength = 1;
  349.         }
  350.         cout << "+" << string(WordLength + 2, '-');
  351.     }
  352.     cout << "|";
  353.  
  354.     cout << endl << "| 32 |";//12th line
  355.     int c = 0;
  356.     for (int i = 32; i < 40; i++)
  357.     {
  358.         int Longest = temp[c].length();
  359.         c++;
  360.         int Short = excel[i].length();
  361.         if (excel[i] == "")
  362.         {
  363.             excel[i] = " ";
  364.         }
  365.         WordLength = Longest - Short +1;
  366.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  367.     }
  368.  
  369.     cout << endl << "|----";//13th line
  370.     for (int i = 0; i < 8; i++)
  371.     {
  372.         WordLength = temp[i].length();
  373.         if (WordLength == 0)
  374.         {
  375.             WordLength = 1;
  376.         }
  377.         cout << "+" << string(WordLength + 2, '-');
  378.     }
  379.     cout << "|";
  380.  
  381.     cout << endl << "| 40 |";//14th line
  382.     int d = 0;
  383.     for (int i = 40; i < 48; i++)
  384.     {
  385.         int Longest = temp[d].length();
  386.         d++;
  387.         int Short = excel[i].length();
  388.         if (excel[i] == "")
  389.         {
  390.             excel[i] = " ";
  391.         }
  392.         WordLength = Longest - Short +1;
  393.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  394.     }
  395.  
  396.     cout << endl << "|----";//15th line
  397.     for (int i = 0; i < 8; i++)
  398.     {
  399.         WordLength = temp[i].length();
  400.         if (WordLength == 0)
  401.         {
  402.             WordLength = 1;
  403.         }
  404.         cout << "+" << string(WordLength + 2, '-');
  405.     }
  406.         cout << "|";
  407.  
  408.     cout << endl << "| 48 |";//16th line
  409.     int e = 0;
  410.     for (int i = 48; i < 56; i++)
  411.     {
  412.         int Longest = temp[e].length();
  413.         e++;
  414.         int Short = excel[i].length();
  415.         if (excel[i] == "")
  416.         {
  417.             excel[i] = " ";
  418.         }
  419.         WordLength = Longest - Short +1;
  420.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  421.     }
  422.  
  423.     cout << endl << "|----";//17th line
  424.     for (int i = 0; i < 8; i++)
  425.     {
  426.         WordLength = temp[i].length();
  427.         if (WordLength == 0)
  428.         {
  429.             WordLength = 1;
  430.         }
  431.         cout << "+" << string(WordLength + 2, '-');
  432.     }
  433.     cout << "|";
  434.  
  435.     cout << endl << "| 56 |";//18th line
  436.     int f = 0;
  437.     for (int i = 56; i < 64; i++)
  438.     {
  439.         int Longest = temp[f].length();
  440.         f++;
  441.         int Short = excel[i].length();
  442.         if (excel[i] == "")
  443.         {
  444.             excel[i] = " ";
  445.         }
  446.         WordLength = Longest - Short +1;
  447.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  448.     }
  449.  
  450.     cout << endl << "|----";//19th line
  451.     for (int i = 0; i < 8; i++)
  452.     {
  453.         WordLength = temp[i].length();
  454.         if (WordLength == 0)
  455.         {
  456.             WordLength = 1;
  457.         }
  458.         cout << "+" << string(WordLength + 2, '-');
  459.     }
  460.     cout << "|";
  461.  
  462.     cout << endl << "| 64 |";//20th line
  463.     int g = 0;
  464.     for (int i = 64; i < 72; i++)
  465.     {
  466.         int Longest = temp[g].length();
  467.         g++;
  468.         int Short = excel[i].length();
  469.         if (excel[i] == "")
  470.         {
  471.             excel[i] = " ";
  472.         }
  473.         WordLength = Longest - Short +1;
  474.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  475.     }
  476.  
  477.     cout << endl << "|----";//21th line
  478.     for (int i = 0; i < 8; i++)
  479.     {
  480.         WordLength = temp[i].length();
  481.         if (WordLength == 0)
  482.         {
  483.             WordLength = 1;
  484.         }
  485.         cout << "+" << string(WordLength + 2, '-');
  486.     }
  487.     cout << "|";
  488.  
  489.     cout << endl << "| 72 |";//22th line
  490.     int h=0;
  491.     for (int i = 72; i < 80; i++)
  492.     {
  493.         int Longest = temp[h].length();
  494.         h++;
  495.         int Short = excel[i].length();
  496.         if (excel[i] == "")
  497.         {
  498.             excel[i] = " ";
  499.         }
  500.         WordLength = Longest - Short +1;
  501.         cout << " " << excel[i] << string(WordLength, ' ') << "|";
  502.     }
  503.        
  504.     cout << endl << "|----";//23th line
  505.     for (int i = 0; i < 8; i++)
  506.     {
  507.         WordLength = temp[i].length();
  508.         if (WordLength == 0)
  509.         {
  510.             WordLength = 1;
  511.         }
  512.         cout << "+" << string(WordLength + 2, '-');
  513.     }
  514.     cout << "|";
  515.  
  516.     cout << endl << endl;
  517. }
  518.  
  519. void New()
  520. {
  521.     cout << "New file name ==> ";
  522.     cin >> FileName;
  523.     if (FileName == "Null")
  524.     {
  525.         cout << "Your file name cannot be Null, please create as another file name." << endl;
  526.         Choose();
  527.     }
  528.  
  529.     for (int i = 0; i < 80; i++) //reset array to blank array
  530.     {
  531.         excel[i] = " ";
  532.     }
  533.     Menu();
  534.     Choose();
  535. }
  536.  
  537. void Insert()
  538. {
  539.     cout << "Tile Number ==> ";
  540.     cin >> TileNum;
  541.     cout << "Text ==> ";
  542.     cin.ignore();
  543.     getline(cin,Text);
  544.     Space = " ";
  545.    
  546.     if (excel[TileNum-1] != " ")
  547.     {
  548.         for (int i = 0; i < 10; i++)
  549.         {
  550.             Temp[i] = " ";
  551.         }
  552.        
  553.         int i = 0;
  554.         size_t pos = 0;
  555.         while ((pos = Text.find(Space)) != string::npos)
  556.         {  
  557.             Token = Text.substr(0, pos);
  558.             Temp[i] = Token;
  559.             i++;
  560.             Text.erase(0, pos + Space.length());
  561.         }
  562.        
  563.         for (int i = 68; i >= (TileNum-1); i--)
  564.         {
  565.             excel[i+11] = excel[i];
  566.             excel[i] = " ";
  567.         }
  568.        
  569.         for (int i = 0; i < 10; i++)
  570.         {
  571.             excel[TileNum-1] = Temp[i];
  572.             TileNum ++;
  573.         }
  574.     }  
  575.  
  576.     size_t pos = 0;
  577.     Text = Text+" ";
  578.     while ((pos = Text.find(Space)) != string::npos) //(while space is not found will return string::npos, so when found it will not return string::npos)//
  579.     {  
  580.         Token = Text.substr(0, pos);//Text.substr(position, length), example: Text = "abc def ghi" , 0 is a, 1 is b. until the length of the abc is 3//
  581.         excel[TileNum-1] = Token;
  582.         TileNum = TileNum +1;      
  583.         Text.erase(0, pos + Space.length());//erase from the first position to the size of word + a space//
  584.     }
  585.  
  586.     for (int i= 0; i<78; i++)
  587.     {
  588.         for(int j = i+1; j<80;j++)
  589.         {
  590.             if ((excel[i] == " ") && (excel[j]!=" "))
  591.             {
  592.                 excel [i] = excel[j];  
  593.                 excel[j] = " ";
  594.                 break;
  595.             }
  596.         }
  597.     }
  598.    
  599. }
  600.  
  601. void Delete()
  602. {
  603.     cout << "From Tile Number == > ";
  604.     cin >> DelTile1;
  605.     cout << "To Tile Number == > ";
  606.     cin >> DelTile2;
  607.    
  608.     for (int i = DelTile1-1; i < DelTile2; i++)
  609.     {
  610.         excel[i] = " ";
  611.     }
  612.  
  613.     for (int i= 0; i<78; i++)
  614.     {
  615.         for(int j = i+1; j<80;j++)
  616.         {
  617.             if ((excel[i] == " ") && (excel[j]!=" "))
  618.             {
  619.                 excel [i] = excel[j];  
  620.                 excel[j] = " ";
  621.                 break;
  622.             }
  623.         }
  624.     }
  625.  
  626. }
  627.  
  628. void Overwrite()
  629. {
  630.     cout << "Tile Number ==> ";
  631.     cin >> TileNum;
  632.     cout << "Text ==> ";
  633.     cin.ignore();
  634.     getline(cin,Text);
  635.     Space = " ";
  636.  
  637.     size_t pos = 0;
  638.     Text = Text+" ";
  639.     while ((pos = Text.find(Space)) != string::npos)
  640.     {  
  641.         Token = Text.substr(0, pos);
  642.         excel[TileNum-1] = Token;
  643.         TileNum = TileNum +1;      
  644.         Text.erase(0, pos + Space.length());
  645.     }
  646.  
  647.     for (int i= 0; i<78; i++)
  648.     {
  649.         for(int j = i+1; j<80;j++)
  650.         {
  651.             if ((excel[i] == " ") && (excel[j]!=" "))
  652.             {
  653.                 excel [i] = excel[j];  
  654.                 excel[j] = " ";
  655.                 break;
  656.             }
  657.         }
  658.     }
  659. }
  660.  
  661. void Load()
  662. {
  663.     for (int i=0; i<80; i++)
  664.     {
  665.         LoadTile[i] = " ";
  666.     }
  667.    
  668.     cout << "File name ==>" ;
  669.     cin.ignore();
  670.     getline(cin,LoadName);
  671.    
  672.     LoadName = LoadName+".txt";
  673.     ifstream Read(LoadName.c_str());
  674.     if (Read.is_open())
  675.     {
  676.         Read.ignore();
  677.         (getline(Read,Line));
  678.         Read.close();
  679.     }
  680.    
  681.     else
  682.     {
  683.         cout << "No File Loaded.";
  684.     }  
  685.     Space = " ";
  686.     int i = 0;
  687.     size_t pos = 0;
  688.     while ((pos = Line.find(Space)) != string::npos)
  689.     {  
  690.         Token = Line.substr(0, pos);
  691.         LoadTile[i] = Token;
  692.         i++;       
  693.         Line.erase(0, pos + Space.length());
  694.     }
  695.     for (int i = 0; i<80; i++)
  696.     {
  697.         excel[i] = LoadTile[i];
  698.     }
  699. }
  700.  
  701.  
  702. void Save()
  703. {
  704.     cout << "File name (enter= "+FileName+".txt) ==> ";
  705.     cin.ignore();
  706.     getline(cin,SaveFile);
  707.     cout << "File saved."<<endl;
  708.    
  709.     if (SaveFile.empty())
  710.     {
  711.         SaveFile = FileName;
  712.         cout << "File saved."<<endl;   
  713.     }
  714.     SaveFile = SaveFile+".txt";
  715.     ofstream Create(SaveFile.c_str());
  716.     for (int i = 0; i < 80; i++)
  717.     {
  718.         Saveas = Saveas + excel[i]+" ";
  719.     }
  720.     Create << Saveas <<endl;
  721.     Create.close();
  722. }
  723.  
  724. void Copy()
  725. {
  726.     for (int i = 0; i < 10; i++)
  727.     {
  728.         CopyExcel[i] = " ";
  729.     }
  730.        
  731.     cout << "From Tile Number == > ";
  732.     cin >> CopyTile1;
  733.     cout << "To Tile Number == > ";
  734.     cin >> CopyTile2;
  735.     if (CopyTile2 - CopyTile1 > 10)
  736.     {
  737.         cout << "You can only copy 10 words" <<endl;
  738.         Choose();
  739.     }
  740.    
  741.     int j = 0;
  742.     for (int i = CopyTile1-1; i < CopyTile2; i++)
  743.     {
  744.         CopyExcel[j]= excel[i];
  745.         j++;
  746.     }
  747. }
  748.  
  749. void Clipboard()
  750. {
  751.     cout << "Clipboard : " << endl;
  752.     for (int i = 0 ; i < 10; i++)
  753.     {
  754.         cout << CopyExcel[i] << " ";
  755.     }
  756.     cout << endl << endl
  757.     << "------------------------ new screen ------------------------"
  758.     <<endl << endl;
  759.    
  760. }
  761.    
  762. void Cut()
  763. {
  764.     for (int i = 0; i < 10; i++)
  765.     {
  766.         CopyExcel[i] = " ";
  767.     }
  768.        
  769.        
  770.     cout << "From Tile Number == > ";
  771.     cin >> CopyTile1;
  772.     cout << "To Tile Number == > ";
  773.     cin >> CopyTile2;
  774.     if (CopyTile2 - CopyTile1 > 10)
  775.     {
  776.         cout << "You can only cut 10 words" <<endl;
  777.         Choose();
  778.     }
  779.    
  780.     int j = 0;
  781.     for (int i = CopyTile1-1; i < CopyTile2; i++)
  782.     {
  783.         CopyExcel[j]= excel[i];
  784.         j++;
  785.     }
  786.    
  787.         for (int i = CopyTile1-1; i < CopyTile2; i++)
  788.     {
  789.         excel[i] = " ";
  790.     }
  791.  
  792.     for (int i= 0; i<78; i++)
  793.     {
  794.         for(int j = i+1; j<80;j++)
  795.         {
  796.             if ((excel[i] == " ") && (excel[j]!=" "))
  797.             {
  798.                 excel [i] = excel[j];  
  799.                 excel[j] = " ";
  800.                 break;
  801.             }
  802.         }
  803.     }
  804.    
  805. }
  806.  
  807. void Paste()
  808. {
  809.     cout << "Tile Number ==> ";
  810.     cin >> TileNum;
  811.    
  812.     for (int i = 68; i >= (TileNum-1); i--)
  813.         {
  814.             excel[i+11] = excel[i];
  815.             excel[i] = " ";
  816.         }
  817.        
  818.     for (int i = 0; i < 10; i++)
  819.     {
  820.         excel[TileNum-1] = CopyExcel[i];
  821.         TileNum ++;
  822.     }
  823.        
  824.     for (int i= 0; i<78; i++)
  825.     {
  826.         for(int j = i+1; j<80;j++)
  827.         {
  828.             if ((excel[i] == " ") && (excel[j]!=" "))
  829.             {
  830.                 excel [i] = excel[j];  
  831.                 excel[j] = " ";
  832.                 break;
  833.             }
  834.         }
  835.     }
  836. }
  837.  
  838. void Find()
  839. {
  840.     cout << "Enter text to find : ";
  841.     cin >> Text;
  842.     for(int i = 0; i < 80; i++)
  843.     {
  844.         if (Text == excel[i])
  845.         {
  846.             excel[i] = "*"+excel[i]+"*";
  847.         }
  848.     }
  849. }
  850.  
  851. void BeforeUndo()
  852. {
  853.     for (int i = 0; i <10; i++)
  854.     {
  855.         UnCE[i] = CopyExcel[i];
  856.     }
  857.    
  858.     for (int i=0; i<80 ; i++)
  859.     {
  860.         UndoTile[i] = excel[i];
  861.     }
  862. }
  863.  
  864. void Undo()
  865. {
  866.     for (int i = 0; i<10;i++)
  867.     {
  868.         CopyExcel[i] = UnCE[i];
  869.     }
  870.    
  871.     for (int i=0; i<80 ; i++)
  872.     {
  873.         excel[i] = UndoTile[i];
  874.     }
  875. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement