ahmed0saber

Idea to source code converter in C++

Nov 5th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. int main()
  5. {
  6.     string this_step;
  7.     string total_code;
  8.     int choice;
  9.     string text;
  10.     cout<<"Hello , I am zero005 , a bot developed by Ahmed Saber , to help you create a c++ app easily , as I will give you the source code of the app you want to create , but first you must tell me all about this app..."<<endl<<endl<<endl;
  11.     // preparing libraries
  12.     again:
  13.     cout<<"First step , here I want to know what you want to use."<<endl<<"Choose by only typing the number of choice then pressing Enter"<<endl<<"1- I want to print text on the screen"<<endl<<"10- I added everything , Let's go to next step"<<endl;
  14.     cin>>choice;
  15.     if (choice==1)
  16.     {
  17.         this_step="#include <iostream> using namespace std;";
  18.         total_code=total_code+this_step;
  19.         goto again;
  20.     }
  21.     else if (choice==10)
  22.     {
  23.         this_step="int main() {";
  24.         total_code=total_code+this_step;
  25.     }
  26.     // let's ask the user about what will be done first then second ...etc
  27.     one_more:
  28.     cout<<endl<<"choose a step to be done"<<endl<<"1- print something"<<endl;
  29.     cin>>choice;
  30.     if (choice==1)
  31.     {
  32.         cout<<"Enter the text you want the app to print (Type without using space)"<<endl;
  33.         cin>>text;
  34.         this_step="cout<<'"+text+"'<<endl;";
  35.         total_code=total_code+this_step;
  36.     }
  37.     // end
  38.     total_code=total_code+"}";
  39.     // create a text file with the source code
  40.     ofstream MyFile("source code.txt");
  41.     MyFile<<total_code;
  42.     MyFile.close();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment