Nofew

Gimprenamelayerstuff

Sep 8th, 2011
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. int main(void) {
  9.     cout << "This program is meant to append frames to GAP animations.\nThe developers seem to have thought of everything, but this." << endl;
  10.     cout << "Please enter the name of the frames, from the starting character\nand including the seporation character." << endl;
  11.     string firstpartoffilename;
  12.     cin >> firstpartoffilename;
  13.     cout << "Please type the last frame's number (Don't add one to it)." << endl;
  14.     int lastusernumber;
  15.     cin >> lastusernumber;
  16.     lastusernumber++;
  17.     cout << "Please type the amount of frames to append." << endl;
  18.     int appendthismany;
  19.     cin >> appendthismany;
  20.     cout << "Please type the extension, including the dot." << endl;
  21.     string extension;
  22.     cin >> extension;
  23.     int spaceavailable;
  24.     cout << "Please type the amount of space for frame numbers." << endl;
  25.     cin >> spaceavailable;
  26.     int spacehold;
  27.     string dome;
  28.     string domf;
  29.  
  30.  
  31.     for(int i = 1; i < (appendthismany+1); i++, lastusernumber++) {
  32.     char arrayone[10];
  33.     char arraytwo[10];
  34.     itoa(i, arrayone, 10);
  35.     itoa(lastusernumber, arraytwo, 10);
  36.     dome = firstpartoffilename;
  37.     if(i < 10) {
  38.         spacehold = (spaceavailable - 1);
  39.     }
  40.     else if(i < 100) {
  41.         spacehold = (spaceavailable - 2);
  42.     }
  43.     else if(i < 1000) {
  44.         spacehold = (spaceavailable - 3);
  45.     }
  46.     else if(i < 10000) {
  47.         spacehold = (spaceavailable - 4);
  48.     }
  49.     else if(i < 100000) {
  50.         spacehold = (spaceavailable - 5);
  51.     }
  52.     else if(i < 1000000) {
  53.         spacehold = (spaceavailable - 6);
  54.     }
  55.     else if(i < 10000000) {
  56.         spacehold = (spaceavailable - 7);
  57.     }
  58.     else if(i < 100000000) {
  59.         spacehold = (spaceavailable - 8);
  60.     }
  61.     else if(i < 1000000000) {
  62.         spacehold = (spaceavailable - 9);
  63.     }
  64.     else {
  65.         cout << "An amount of frames this large may exceed this program's limitations. Sorry." << endl;
  66.         return 0;
  67.     }
  68.     for(;spacehold > 0; spacehold--) {
  69.         dome += "0";
  70.     }
  71.  
  72.  
  73.  
  74.     dome += arrayone;
  75.     dome += extension;
  76.     domf = firstpartoffilename;
  77.  
  78.     if(lastusernumber < 10) {
  79.         spacehold = (spaceavailable - 1);
  80.     }
  81.     else if(lastusernumber < 100) {
  82.         spacehold = (spaceavailable - 2);
  83.     }
  84.     else if(lastusernumber < 1000) {
  85.         spacehold = (spaceavailable - 3);
  86.     }
  87.     else if(lastusernumber < 10000) {
  88.         spacehold = (spaceavailable - 4);
  89.     }
  90.     else if(lastusernumber < 100000) {
  91.         spacehold = (spaceavailable - 5);
  92.     }
  93.     else if(lastusernumber < 1000000) {
  94.         spacehold = (spaceavailable - 6);
  95.     }
  96.     else if(lastusernumber < 10000000) {
  97.         spacehold = (spaceavailable - 7);
  98.     }
  99.     else if(lastusernumber < 100000000) {
  100.         spacehold = (spaceavailable - 8);
  101.     }
  102.     else if(lastusernumber < 1000000000) {
  103.         spacehold = (spaceavailable - 9);
  104.     }
  105.     else {
  106.         cout << "An amount of frames this large may exceed this program's limitations. Sorry." << endl;
  107.         return 0;
  108.     }
  109.     for(;spacehold > 0; spacehold--) {
  110.         domf += "0";
  111.     }
  112.  
  113.  
  114.     domf += arraytwo;
  115.     domf += extension;
  116.     rename(dome.c_str(), domf.c_str());
  117.     }
  118.  
  119.  
  120.     return 0;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment