More questions I have about programming...

This forum is for actual topics of discussion that do not fit the above categories.
Locked
User avatar
klinky
Joined: Mon Jul 23, 2001 12:23 am
Location: Cookie College...
Contact:
Org Profile

Post by klinky » Tue Dec 10, 2002 9:08 pm

kthulhu wrote:
klinky wrote: Err and let me try my hand at a c++ version:

Code: Select all

#include<iostream.h>

char age; <------forgot that sucker there

void main() {
 cout << "How old are you?;
 cin >> age;
 cout << "\nYou are " <<age;
}
That crashed my Loonix :cry: !!!
Well it probably wouldn't have compiled since I forgot the semi-colon... >_< see what I mean.

Bad habits... bad habits :p

~klinky

User avatar
CaTaClYsM
Joined: Fri Jul 26, 2002 3:54 am
Org Profile

Post by CaTaClYsM » Tue Dec 10, 2002 9:35 pm

I am definetly going to want to get into creating games. I was originaly going for a C++ class, but they suggested I take Visual Basic first so I thought they knew better than I did so I went for it. BTW, what do my math skills need to be at?
So in other words, one part of the community is waging war on another part of the community because they take their community seriously enough to want to do so. Then they tell the powerless side to get over the loss cause it's just an online community. I'm glad people make so much sense." -- Tab

danielwang
Village Idiot
Joined: Fri May 03, 2002 12:17 am
Location: Denver, CO Banned: Several times!
Contact:
Org Profile

Post by danielwang » Tue Dec 10, 2002 9:55 pm

Math isn't really fundamental, but knowing logic and operators, etc, is. You won't need to know how to do IBP on a second-order QA, or laplace a PDE >.< or anything horrible like that...

VB is cool, it's not as stupid as people think and I created my first game (um, RPG thingy) out of off-the-shelf collaboration groupware, ASP.NET and Microsoft SQL Server... then you should get into object-oriented hacking and stuff, so you can do things like real 3D games.

Games aren't that hard at all, most of it is in libraries already. Component object model and .NET Framework do most of the crap as well (thank you microsoft), but you will have to know how to call services and modules as well.

Have fun,
Daniel Wang

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Tue Dec 10, 2002 10:22 pm

klinky wrote: Err and let me try my hand at a c++ version:

Code: Select all

#include<iostream.h>

char age

void main() {
 cout << "How old are you?;
 cin >> age;
 cout << "\nYou are " <<age;
}
Nope. The correct version is:

Code: Select all

#include <iostream>

using namespace std;


int main(int argc, char **argv)
{ 
  int age; // compensate for stupidity on the user's behalf --
              // we should be using an unsigned short int
              // but people like to break things

  cout << "How old are you?";
  cin >> age;
  cout << endl << "You are " << age << endl;
  return 0;
}
Much of it is semantics, but most of them are semantics that really make a difference.

Mathematics is very important to learning how a computer operates, especially discrete and combinatorial mathematics. (I'm learning that myself, so don't ask what the heck it is.) Mathematics and logic factor (ha ha, factor) hugely into important fields such as algorithm analysis and data structures.

As for me, though:

I started in QBASIC on an Intel 8088 machine (whee). Worked in VB for some time, and then discovered a C compiler (I can't remember who was the compiler vendor). Played with that for a while, started playing with C++, had fun with that.

Installed GNU/Linux and FreeBSD on a few systems. Started having fun with PERL, PHP, and some Bourne shell scripts.

Then came along this awesome book: Programming Languages, by Dr. Allen B. Tucker. If you just want to be a programmer, it may not be that cool. But if you're a total geek like me who likes to learn about programming language theory for the sheer hell of it, it's really, really cool. With that I picked up a working knowledge of PROLOG and LISP and a couple others.

So it's basically been one big playtime for me. The amazing thing is that what I thought was just one big game about eight or nine years ago (and still do) is a respected major. :shock:

User avatar
CaTaClYsM
Joined: Fri Jul 26, 2002 3:54 am
Org Profile

Post by CaTaClYsM » Tue Dec 10, 2002 11:12 pm

I realy did luck out I have about a billion books lying around about programming and crap like that, I even found an old pascal compiler lying around in my closet. (to bad it's on 5'something inch floppy disks. I don't have s drive that can use the disks. lol)
So in other words, one part of the community is waging war on another part of the community because they take their community seriously enough to want to do so. Then they tell the powerless side to get over the loss cause it's just an online community. I'm glad people make so much sense." -- Tab

danielwang
Village Idiot
Joined: Fri May 03, 2002 12:17 am
Location: Denver, CO Banned: Several times!
Contact:
Org Profile

Post by danielwang » Fri Dec 20, 2002 4:01 am

O.o trythil moved...

Anyways aren't you supposed to use
return age;;
? Although the age variable can be stored globally, if this was some silly age-scneario this would add to the code's maintainability and u can ask for age on demand...

then, also a check to see if age is already defined,
waaait I'm going to far! augh gotta go find Geeks Anonymous...

User avatar
Aetherfukz
Joined: Tue Jul 02, 2002 3:49 pm
Location: My own private hell...
Contact:
Org Profile

Post by Aetherfukz » Fri Dec 20, 2002 4:49 am

danielwang wrote:Anyways aren't you supposed to use
return age;;
But where would you catch the return-variable then? You are already in the main function, so return 0 is just a normal program end...
But anyways, where did you say are those anonymous geeks located..? :roll:

Peace out,
~Aetherfukz
Image

User avatar
Anime Jedi
Joined: Sun May 19, 2002 11:16 am
Location: Wandering Aimlessly (Canada)
Org Profile

Re: More questions I have about programming...

Post by Anime Jedi » Fri Dec 20, 2002 7:01 am

y2kwizard wrote:OK, got a couple of questions for you guys about your programming language of choice.

First of all, how long did it take you to learn your first programming language relatively completely, to the point where you could make productive programs? Also, how difficult was the process?

Second, how easy was it to learn other languages after you had mastered the first? Was it any easier or harder to learn the new languages?

Finally, what is the best way to learn a programming language? A book, class, CD tutorial, or something else? Any specific items you'd recommend?

Finally, what do you use your programming skills for, and are you satisfied with your decision to learn programming? Was it worth it? Would you recommend it to others?

Thanks a lot!
Visual basic :D

I using i right now in class. Last year I went through half the year not understanding anything, but this year it's all coming together. So I'd like to think about 2 years, of one class a day for half the year. So in reality, not exactly that long.

I haven't learned any other programming languages.

Well, I can't exactly comment on any other way than class. But class is pretty good, because if something is really confusing, you can alwaya ask around. :D

Right now, I'm making a nice little anime information program. If you wanted to know my relative skill, I'm using stuff like arrays, File I/O, making your own functions and making your own subprocedures. :? :wink:

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Fri Dec 20, 2002 8:56 am

danielwang wrote:O.o trythil moved...

Anyways aren't you supposed to use
return age;;
? Although the age variable can be stored globally, if this was some silly age-scneario this would add to the code's maintainability and u can ask for age on demand...

then, also a check to see if age is already defined,
waaait I'm going to far! augh gotta go find Geeks Anonymous...
No, since the returned value from the main() function is the program's exit code. Generally, if it's non-zero, that means something broke.

If you had another function that asked for age

Code: Select all


#include <iostream>

int getAge();

int main(int argc, char **argv)
{
...
  std::cout << "How old are you?"; 
  int age = getAge();
...
   return 0;
}

int getAge()
{
   int age;
   std::cin >> age; 
   return age;
}
then that's when return age; would be appropriate.

And yes, I moved -- it's college time...

Locked

Return to “General Off Topic”