OP 23 March, 2021 - 09:01 AM
Currently learning how to code in c++ so i figured why not make this to learn more about certain things.
I did not build it to an .exe cause i might make updates to the code.
What the code currently does:
- Randomly generates 13 letters
- Saves it to a local file on your computer named "codesoutput.txt"
Updates I plan on doing:
- Adding a checker
- Possibly adding proxy support
Now obviously the chances of you actually generating a working giftcard is insanely low, but it was a fun project.
I did not build it to an .exe cause i might make updates to the code.
What the code currently does:
- Randomly generates 13 letters
- Saves it to a local file on your computer named "codesoutput.txt"
Code:
//Amazon GC generator + checker
//by Omy
#include <iostream>
#include <ctime>
//#include <windows.h>
#include <string>
#include <fstream>
using namespace std;
void menu();
void generateCodes();
int main()
{
menu();
system("pause");
return 0;
}
void menu()
{
int user_choice;
cout << "Amazon GC Generator\n"
<< "[1] Generate Codes\n";
cin >> user_choice;
switch (user_choice)
{
case 1:
generateCodes();
break;
default:
cout << "Incorrect Selection!\n";
}
}
void generateCodes()
{
int amount_codes;
char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //char array, we will use this to select random letters
string test;
srand(time(NULL)); //seed the random, otherwise it will be the same each time
cout << "Enter amount of codes: ";
cin >> amount_codes;
ofstream gencodes;
gencodes.open("codesoutput.txt");
cout << "You have chosen " << amount_codes << " codes to generate! (If it says 0 please input an integer). " << endl;
int i = 1; //counter for the codes
while (i <= amount_codes) {
cout << i;
i++;
for (int j = 0; j < 13; j++) {
gencodes << letters[rand() % 26]; //print char one by one
}
gencodes << endl; //print new line after you make the random string
}
cout << endl;
cout << "Check your .txt file to view your codes!\n\n";
gencodes.close();
return menu();
}
Updates I plan on doing:
- Adding a checker
- Possibly adding proxy support
Now obviously the chances of you actually generating a working giftcard is insanely low, but it was a fun project.