|
|
|
|
|
April 20th, 2005, 04:16 PM
|
|
Second Lieutenant
|
|
Join Date: Mar 2005
Location: Seattle, WA
Posts: 417
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
Suggestion for version 2:
Separate input, output and processing into their own functions. It's real good exercise. Something like
main(){
get_input( variables )
process_input( variables )
put_output(screen)
put_output(file)
}
My brother never learned to use functions, and now he codes his entire programs all in main().
So now he can't write big programs, because after a while it becomes too much to follow in one function.
Try reading a 500-line function! One page is plenty.
|
April 20th, 2005, 06:40 PM
|
|
Major General
|
|
Join Date: Nov 2004
Location: Floating in space.
Posts: 2,297
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
Nothing compared to my 500 or so lines of spagetti code written in qbasic.
|
April 20th, 2005, 08:12 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: OT: Look what I can do...
Quote:
aiken said:
It only means that geo's really first programm was written in Basic.
But he will never admit it
|
Most programmers started in Basic.
And most wont admit it.
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
|
April 20th, 2005, 09:56 PM
|
|
Sergeant
|
|
Join Date: Jan 2004
Posts: 203
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
I don't believe "cout" or "cin" is in C, so it must be C++.
__________________
"The difference between very sophisticated technology and magic is a very blurry line,� Dean Kamen, Wizard of IT
|
April 20th, 2005, 10:16 PM
|
|
Lieutenant Colonel
|
|
Join Date: Mar 2001
Location: Emeryville, CA
Posts: 1,412
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
Quote:
boran_blok said:
Lemme tell you, that is C not C++ it might be C++ syntax but C++ implies OO programming. dunno if you guys see that.
having a single main aint a good sign
but if it's meant to be procedural it looks like a well structured program.
|
Ah, but there are objects. He clearly uses both the pre-defined cin and cout for standard input and standard output, respectively, and also uses the class ofstream for file output. Just because he hasn't created a class doesn't mean it's not OOP. I think Java has started to rot people's minds, making programmers think something is never OO unless you type "class foo" somewhere...
And I don't know about the rest of you, but I started in C, at 14 years old. A year later I learned "BASIC", but it was the version in my TI calculator, not this Visual nonsense. I technically still haven't "learned" VB, but really, do I need to? I can read the stuff, and if I'm ever asked to write it for some horrid reason... well, I'll burn that bridge when I get to it.
__________________
GEEK CODE V.3.12: GCS/E d-- s: a-- C++ US+ P+ L++ E--- W+++ N+ !o? K- w-- !O M++ V? PS+ PE Y+ PGP t- 5++ X R !tv-- b+++ DI++ D+ G+ e+++ h !r*-- y?
SE4 CODE: A-- Se+++* GdY $?/++ Fr! C++* Css Sf Ai Au- M+ MpN S Ss- RV Pw- Fq-- Nd Rp+ G- Mm++ Bb@ Tcp- L+
|
April 20th, 2005, 10:17 PM
|
|
General
|
|
Join Date: Jan 2003
Location: Atlanta, GA
Posts: 3,499
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
Gotta take my hat off to anyone who's got the initiative to learn a programminglanguage this "late in the game".
__________________
ALLIANCE, n. In international politics, the union of two thieves who have their hands so deeply inserted in each other's pocket that they cannot separately plunder a third. (Ambrose Bierce)
|
April 20th, 2005, 11:15 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Feb 2001
Location: Waterloo, Ontario, Canada
Posts: 11,451
Thanks: 1
Thanked 4 Times in 4 Posts
|
|
Re: OT: Look what I can do...
Quote:
NullAshton said:
Nothing compared to my 500 or so lines of spagetti code written in qbasic.
|
Or my first serious program, which was almost a thousand lines of GW-Basic code.
All my variables were 4 or 5 character acronyms.
And it had no elses or block-ifs, since I didn't know about them at the time.
Instead, I used If-Dosomething-Goto
I'd estimate that up to 10% of the instructions in that program were gotos!
But at least it was neat, well organized spaghetti code.
__________________
Things you want:
|
April 20th, 2005, 11:58 PM
|
|
Captain
|
|
Join Date: Nov 2003
Location: At work or sleeping
Posts: 821
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
Quote:
Slynky said:
Gotta take my hat off to anyone who's got the initiative to learn a programminglanguage this "late in the game".
|
Amen brother.
__________________
Aa Turam Empire
Geekdom is eternal... you will be assimilated... resistance is futile.
A+ Se GdY S++ Fr- C* Cs* Sf- Ai++ Au>M! M- Mp! S@ Ss+ R! Pw+ Fq++ Nd? Rp++ G++ Mm++ Bb-- L-- Tcp
'We, the weird, chasing the pointless, for no reason at all, have been finding out things that have no effect on anything important for at least a couple days and are now qualified to chase our tails to the merriment of all watching.'-Narf et al
"Of course, you don't want to be going about handing out immortality willy-nilly, that just wouldn't be responsible." -O'Shea
|
April 21st, 2005, 12:56 AM
|
|
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: OT: Look what I can do...
Anyone who knows more than one language would be hard pressed to tell you to learn or not learn any particular programming language without afew more answers. In other words, dont bother learning VB unless and until you have a reason to. Something that you want to do, which it does well. Same goes for any other language. They all have their pros and cons
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
|
April 21st, 2005, 01:25 AM
|
|
Lieutenant General
|
|
Join Date: Nov 2002
Posts: 2,903
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Re: OT: Look what I can do...
My first program was indeed a hello world program written in BASIC, on the Apple IIE. I was so happy and proud to be learning how to program a computer. That was a long long time ago. That year I went on to write spagetti code. In those days, each line of code had a line number and you had stuff like, "100 goto 250".
Then when I took my first programming course in university, on the first day the professor asked, "put up your hand if your first programming language was BASIC". I put up my hand, along with about half the people in the class. The professor says, "You are all contaminated - you learned to write spagetti code!". That course used Modula-2, and they were very strict about your code being neatly organized. That was a good thing, because I got rid of the bad habits I picked up earlier.
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|