Advertisement
sm4rtn0bit4

self replecating code-1

Jul 2nd, 2017
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. // Self replicating basic code
  2.  
  3. #include <iostream>     //1 line  
  4. #include <string>       //2 line   
  5. using namespace std;        //3 line   
  6.                 //4 line   
  7. int main(int argc, char* argv[])    //5th line 
  8. {
  9.         char q = 34;            //7th line 
  10.         string l[] = {      //8th line  ---- code will pause here and will resume later in 3rd for loop
  11.  " ",
  12.  "#include <iostream>       //1 line   ",
  13.  "#include <string>     //2 line    ",
  14.  "using namespace std;      //3 line    ",
  15.  "              //4 line    ",
  16.  "int main(int argc, char* argv[])  //5th line  ",
  17.  "{",
  18.  "        char q = 34;          //7th line  ",
  19.  "        string l[] = {        //8th line  ",
  20.  "        };                //9th resume printing end part of code  ",      //3rd loop starts printing from here
  21.  "        for(int i = 0; i < 9; i++)        //10th first half code ",
  22.  "                cout << l[i] << endl;     //11th line",
  23.  "        for(int i = 0; i < 18; i++)   //12th whole code ",
  24.  "                cout << l[0] + q + l[i] + q + ',' << endl;    13th line",
  25.  "        for(int i = 9; i < 18; i++)   //14th last part of code",
  26.  "                cout << l[i] << endl;     //15th line",
  27.  "        return 0;         //16th line",
  28.  "}             //17th line",
  29.         };                                          //9th resume printing end part of code 
  30.         for(int i = 0; i < 9; i++)      //10th first half code
  31.                 cout << l[i] << endl;       //11th line
  32.         for(int i = 0; i < 18; i++) //12th whole code
  33.                 cout << l[0] + q + l[i] + q + ',' << endl;  13th line
  34.         for(int i = 9; i < 18; i++) //14th last part of code
  35.                 cout << l[i] << endl;       //15th line
  36.         return 0;           //16th line
  37. }               //17th line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement