Computer Science Canada Binary multiplication... |
Author: | Pa|2a|)oX [ Sat Feb 19, 2005 7:33 pm ] | ||
Post subject: | Binary multiplication... | ||
Another program done, this is the multiplication of binary numbers. Once again there are no shortcuts taken, I had to ouput to a text file and retrieve the data to do it properly. This stuff is so rewarding ![]() Once again it is not error trapped. Any input other than binary digits will crash it. Also the maximum number to multiply by is 10110, i can add more, i just stopped at 22.
|
Author: | ssr [ Sat Feb 19, 2005 8:21 pm ] | ||
Post subject: | |||
I just looked at ur code, seems nice, but is definitely reduceable liek the last if, u just have to put
put nice program ![]() |
Author: | Pa|2a|)oX [ Sat Feb 19, 2005 9:48 pm ] |
Post subject: | |
Ya I wasn't looking to reduce, just make it functional. This wasn't an easy thing to do in Turing. Took me a while for both the addition and the multiplication. Most of the other students in the class had the ability to do it in java, but seeing as I never took that class I don't know Java, so I was stuck with Turing. Teachers in previous years didn't teach us any of the stuff about arrays or file outputs, and up until a few days ago, I thought there would be no way for me to do these programs in Turing. Luckily I started looking through the Help files and found both the array function and the file output stuff. Couldn't have done it without that. I am currently in the midst of making a subtraction program for binary, using twos compliment as the backbone, and the addition as usual. |
Author: | ssr [ Sun Feb 20, 2005 8:19 am ] |
Post subject: | |
lol ya, schools.... anyway, I think it is a pretty good program. ![]() |
Author: | person [ Sun Feb 20, 2005 12:01 pm ] |
Post subject: | |
this is cool...but its almost the same as ur other progs...shouldnt u have just posted them in the same thread? |
Author: | Pa|2a|)oX [ Sun Feb 20, 2005 12:32 pm ] |
Post subject: | |
I didn't finish them all at one time so I've been posting them seperately. Sorry. |
Author: | Andy [ Sun Feb 20, 2005 4:39 pm ] |
Post subject: | |
umm, you do realize that the samething can be achieved in less than 20 lines by using strint and intstr right? |
Author: | Pa|2a|)oX [ Sun Feb 20, 2005 5:59 pm ] |
Post subject: | |
This was not meant to use built in shortcuts, but instead to get a full algorithm to understand the complexity of such a task. It was an assignment, for Grade 12 engineering. We're going to be doing all this crap in assembler next. |
Author: | Andy [ Sun Feb 20, 2005 6:24 pm ] |
Post subject: | |
and ur if else structure can be replaced by a simple index and a bit of gr 10 math |
Author: | Pa|2a|)oX [ Sun Feb 20, 2005 6:36 pm ] |
Post subject: | |
Why so negative towards me? |
Author: | Andy [ Sun Feb 20, 2005 6:41 pm ] |
Post subject: | |
what makes you think that? im just saying, for a gr 12, you should be able to program somewhat intelligently, ie make a general case using string manipulation instead of doing it case by case |
Author: | Pa|2a|)oX [ Sun Feb 20, 2005 7:26 pm ] |
Post subject: | |
That's what I mean. Maybe programming isn't my forte, and maybe this is the reason I am using turing instead of a higher programming language. I came here to get help, I got it, and I made a program that works. I greatly appreciate the help I recieved from both Tony, and Cervantes, among other board members. I am not marketting this program, I am submitting it for marks that I will most certainly obtain. The fact that I cannot "intelligently" program, by your standards, does not interfere with the fact that this program is functional and serves its purpose to a point. Who said I was a full fledged programmer? And who stated that every grade 12 should have the ability to program up to YOUR standards? Nice to have a board representative such as yourself around. |
Author: | ssr [ Sun Feb 20, 2005 9:15 pm ] |
Post subject: | |
Quote: That's what I mean. Maybe programming isn't my forte, and maybe this is the reason I am using turing instead of a higher programming language.
I came here to get help, I got it, and I made a program that works. I greatly appreciate the help I recieved from both Tony, and Cervantes, among other board members. I am not marketting this program, I am submitting it for marks that I will most certainly obtain. The fact that I cannot "intelligently" program, by your standards, does not interfere with the fact that this program is functional and serves its purpose to a point. Who said I was a full fledged programmer? And who stated that every grade 12 should have the ability to program up to YOUR standards? Nice to have a board representative such as yourself around. ooo may be u should be a writer... but what Andy was saying is that ur program can be reduced, but if this is what u want, its ok ![]() ![]() |
Author: | Pa|2a|)oX [ Sun Feb 20, 2005 9:24 pm ] |
Post subject: | |
I have no problem with what he's saying, just how he's saying it. "...a bit of gr 10 math." "...im just saying, for a gr 12, you should be able to program somewhat intelligently..." |
Author: | ssr [ Sun Feb 20, 2005 9:32 pm ] |
Post subject: | |
oo well we all should calm down and be happy in this forum everyone should help each other... so... be happy and I dont mean "gay" ***** I know this is off topic here but I just like to point out, 'cause there were some insults happening in this forum, I dont refer to "Andy", there were some posts last few days that were pretty bad... so, lets make this forum more helpful ![]() ![]() ![]() |
Author: | Andy [ Mon Feb 21, 2005 3:41 pm ] |
Post subject: | |
if i came off sounding insulting then i appologize, ssr is right, im not here to make fun of people. i was simply suggesting that your program can be done in a more efficient manner |
Author: | Pa|2a|)oX [ Mon Feb 21, 2005 7:16 pm ] |
Post subject: | |
Thank you for the apology. I totally agree that the program can be snipped to at least half its size by doing a general case where I switch variables around sintead of having a case by case structure. It's the same with my other programs, I just made these programs in about 5 hours each and by the end I just wanted to get it over with. Thanks, right now I'm working on the division, something tells me I'm not going to be able to finish it. Oh well. |
Author: | Andy [ Tue Feb 22, 2005 4:11 pm ] |
Post subject: | |
for your program, do you have to everything in base 2? cant you convert it to base 10, do your stuff then convert back? also 5 hrs is a long time... i never spend more than 4 hrs on my compsci projects (except finals) ... even 1000 line ones... also, u ever heard of recursion? |
Author: | Pa|2a|)oX [ Tue Feb 22, 2005 5:55 pm ] |
Post subject: | |
Yes, it has to be in base 2. I haven't heard of recursion no, care to elaborate? |
Author: | Andy [ Tue Feb 22, 2005 6:13 pm ] |
Post subject: | |
basicly its a function or program that recalls it self each time until the final value is computed... you can use it to do your binary addition/multiplication/subraction/division easily since you basicly do the same procedure each time... go look up on it in the tutorials... then post some attempts and i'll help you do the rest |