It's not working... here's the code now...
- Code: Select all
// Random Password Generator by ----------------------.
// Copyright © 2008-2013. All rights reserved.
#include <iostream>
#include <fstream.h>
#include <stdlib.h>
using namespace std;
int main() {
srand(time(NULL));
int pass_Length = 0;
char characters [] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\0' };
int characters_len = sizeof(characters) / sizeof(char);
string password;
while (pass_Length < 20) {
string password += characters[rand()%characters_len];
pass_Length++;
}
ofstream fout("password.txt");
fout << "The password generated was: " << password << "\n";
fout << flush;
fout.close();
cout << endl;
system("PAUSE");
return 0;
}
And the compiler is giving me these errors...
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Users\PaCkEtPiRaTe\Documents\password_generator.cpp" -o "C:\Users\PaCkEtPiRaTe\Documents\password_generator.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/fstream.h:31,
from C:\Users\PaCkEtPiRaTe\Documents\password_generator.cpp:4:
C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
C:\Users\PaCkEtPiRaTe\Documents\password_generator.cpp: In function `int main()':
C:\Users\PaCkEtPiRaTe\Documents\password_generator.cpp:16: error: expected primary-expression before "password"
C:\Users\PaCkEtPiRaTe\Documents\password_generator.cpp:16: error: expected `;' before "password"
Execution terminated
It will run, but it won't write the file.
Edit: I just realized this is on the wrong board... can someone please move this to the normal Programming board? Didn't realize this was the missions programming board.