Greetings. This is my first official post on the C++ Forums. I have very little experience with the C++ language - but I've been sitting on an idea for a program for a couple years now. So I've decided to try to make a prototype of the most basic function of the program I have in mind. Something to build from and test with.
Again, I have very little programming ability, I've never taken any formal classes or ever completed one of those "For Dummies" books. So what I have managed to scrape by - I've gleaned from other sources.
So without cluttering this post up with too much back story the program needs to do the following:
Step 1: Load from a file with an undetermined amount of ASCII decimal characters (0-9) approximately 8192 characters. (the file could hold millions of characters - but it just needs to grab the first 8192.
Step 2: Process the 8192 characters grabbed - by applying 1022 different keys. The keys would act as switches to turn the decimal characters directly into a binary string. For instance if the string included the numbers 1923, and the key was 1010010000 (0123456789) then the output of the string 1923 would be 0010. I want to apply 1022 out of a possible 1024 keys, excluding the keys that would produce all 1's or all 0's.
Step 3: For each key applied to the string - I want to create a file containing the binary output. So there would be 1022 files created. And a text log file created to store the filename of the file created and 2 hash values (CRC32 and ADLER32 should work) With good formatting so it looks organized when viewed in notepad.
Step 4: A window should pop up - asking if I would like to proceed to the next set of characters in the file. If yes is selected, the program should repeat, but this time - it should grab 8192 characters from the file, starting at the 2nd character in the file. (so it only shifted over 1 character) A new folder with the time/date should be created and filled with the next 1022 filed + log file. This process should be able to be repeated either manually by pressing yes every time, or automatically by selecting a "don't ask again" checkbox.
Sorry if that's a lot of information. But that's what I need. And I'm not sure how to get there from here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#include <iostream>
#include <string>
#include <fstring>
Using namespace std:
int main() {
ofstream fout("C:\\Pi.txt");
string my_input, my_ouput;
// Initialize my_input somehow
for (i = 0; i < my_input.size(); ++i) {
my_output = my_output + (char) convert_char(my_input[i]);
}
int convert_char(int c) {
if (keyed_value(c - '0')) // Otherwise, return a '1' or '0'.
return '1';
else
return '0';
}
int key_array[10];
bool get_key_value(int n) {
return (key_array[n] == 1);
}
bool get_key_value(int n) {
int i = 9 - n;
return (key_array[i] == '1');
}
// Return a string that contains all the values in the argument, key_array, but
// with embedded spaces removed.
string get_temporary_string(string key_array) {
string temp_str;
for (i = 0; i < key_array.length(); ++i) {
if (key_array[i] != ' ') {
temp_str = temp_str + (char) key_array[i];
}
]
return temp_str;
}
}
|
I realize there's a lot to do on this - and I'm not asking anyone to write it for me or anything like that - I just need a little help with the different pieces so I can put it together. Any help would be appreciated - I thank you all in advance.
-Nyxe