Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Author: Daniel Balla, Date: August, 2013;
- * Source code released for free use only;
- * Not for selling;
- * Please feel free to use and improve it;
- * Desinged on Ubuntu 12.04;
- * Required compilers: GCC, G++;
- */
- #include <iostream>
- #include <fstream>
- #include "header.h"
- using namespace std;
- int main()
- {
- cout << "\nWhich table do you want to write in?";
- cout << "\n 1. npc_vendor";
- cout << "\n press q to quit\n";
- char in;
- ofstream SQLQuery("script.sql");
- in=getchar();
- if (in=='1')
- {
- cout << "\nPlease type in the entry of the vendor:";
- int entry;
- cin >> entry;
- cout << "\nPlease type in the extended cost of the items:";
- int extended_cost;
- cin >> extended_cost;
- cout << "\nPlease type in the time (millisecs) this item is able to be bought:";
- int incrtime;
- cin >> incrtime;
- cout << "\nPlease type in how many times can this item be bought:";
- int maxcount;
- cin >> maxcount;
- cout << "\nPlease type in the item IDs (if you have finished press q)\n";
- string item;
- string start="INSERT INTO `npc_vendor` (`entry`, `item`, `maxcount`, `incrtime`, `ExtendedCost`) VALUES\n";
- cout << start;
- SQLQuery << start;
- int line=1;
- do
- {
- cin >> item;
- if (item=="q" or item=="Q")
- {
- cout << ";";
- SQLQuery << ";";
- cout << "\nThanks for using the program! If you want to donate us: http://bloodsyndicate.vng.hu";
- }
- else
- {
- if (line==1)
- {
- cout << "\n";
- SQLQuery << "\n";
- cout << "('" << entry << "', '" << item << "', '" << maxcount << "', '" << incrtime << "', '" << extended_cost << "')";
- SQLQuery << "('" << entry << "', '" << item << "', '" << maxcount << "', '" << incrtime << "', '" << extended_cost << "')";
- line++;
- }
- else
- {
- cout << ",\n";
- SQLQuery << ",\n";
- cout << "('" << entry << "', '" << item << "', '" << maxcount << "', '" << incrtime << "', '" << extended_cost << "')";
- SQLQuery << "('" << entry << "', '" << item << "', '" << maxcount << "', '" << incrtime << "', '" << extended_cost << "')";
- }
- }
- }
- while (item!="q" or item=="Q");
- }
- if (in=='q' or in=='Q')
- {
- cout << "\nThanks for using the program! If you want to donate us: http://bloodsyndicate.vng.hu";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement