Okay, so, I've already done Programming 12, but seeing as I'd decided to learn more programming languages, I chose to transcribe the main ideas from PHP to C++. Unfortunately, there is no proper string -> array splitter on C++ that I can find! So I decided to do this...:
- Code: Select all
//VARIABLES
x = 0;
char passArray(sizeof[PASSWORD]);
/*Chops up password into array*/
while (x>sizeof(PASSWORD))
{
passArray[x]=PASSWORD.substr(x,1); //ERROR IN SYNTAX IS HERE
x = x++;
}
Unfortunately... There's something wrong with the 'passArray[x]=PASSWORD.substr(x,1)'. To me, it looks fine: it tells the program to add the first letter of the string PASSWORD to the array passArray. The only thing that I know may look wrong is the substr(x,1)... That's to say, I'm not sure if 0,1 would select the first letter, or whether I'd need to put x+1,1 (or more properly, 1,1).
Now, I'm using the Bloodshed Dev, and the syntax error report I receive from that is thus:
- Code: Select all
33 | C:\Documents and Settings\Connor\My Documents\Cryptography program.cpp | cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `char' in assignment
And I'd be lying if I said I understood a word of ANYTHING after 'convert'... If you can think of anything, I'd be very grateful if you could either PM or respond here...
THANKS A LOT

Code2004 // Connor