arrays in pseudocode
Im still working on the ISBN project and now Ive validated it, the next step is to convert a 10-digit ISBN to a 13-digit ISBN. I got the formular for that now I want to create procedural pseudocode showing the steps. I was thinking of using an array to store the 10 digit array because inorder to convert it I have to divide the digits somehow coz the formular wants us to add the digits in the even positions then multiply them by 3, add that to the sum of the digits in the odd positions...and so on. So if this was a normal c# problem I'd store the ISBN in a file each digit seperated by a character e.g 0#2#3#0#4#5#6#4#7#9 so that I can use a streamreader to store the odd numbers alone and the even numbers alone in seperate arrays... I'll stop here for now in case thers things that aren't clear. Thanks
VulpesPosted Apr 18, 2011, 10:42 AM
However, to write a string to a file you can do:
System.IO.File.WriteAllText(filePath, myString);
or, if you're working from a char array, you need this step first:
string myString = new string(myCharArray);
No delimiters have been added in either case.
Avuya MxoliPosted Apr 19, 2011, 1:56 AM
Avuya MxoliPosted Apr 19, 2011, 1:54 AM
Sam HobbsPosted Apr 18, 2011, 3:54 PM
So do you want help with real code (not pseudocode) for reading ISBNs?
Avuya MxoliPosted Apr 18, 2011, 2:57 AM
VulpesPosted Apr 4, 2011, 9:17 AM
However, here's my attempt:
STORE in 'remainder'
Avuya MxoliPosted Apr 4, 2011, 6:54 AM
Sam HobbsPosted Apr 3, 2011, 3:09 PM
Okay, sorry Vulpes; I now see your note that the bottom of your post says what I said.
VulpesPosted Apr 3, 2011, 11:34 AM
Incidentally, there's no real need for the # separators in the file. You could still do it by iterating through the characters in the string and converting them to digits - the code would need adjusting a bit.