Search Members Help

» Welcome Guest
[ Log In :: Register ]

Page 1 of 212>>

[ Track This Topic :: Email This Topic :: Print this topic ]

reply to topic new topic new poll
Topic: C programming exercise< Next Oldest | Next Newest >
 Post Number: 1
LiNeY Search for posts by this member.
Lady of DetNet
Avatar



Group: Members
Posts: 782
Joined: Dec. 2000
PostIcon Posted on: Oct. 24 2001,19:26  Skip to the next post in this topic. Ignore posts   QUOTE

As posted before, I started teaching myself programming C. I love it, and it's real fun... I got as far as pointers, and I think I even understood what they're about. However, I haven't been doing anything in the last weeks, because I didn't have anything useful to do. I mean... I could write simple (very simple!) programs, if I knew what to write a program about. I need tasks, or exercises, or challenges, or whatever.

Do any of you guys have an idea what I could do? It shouldn't be too difficult (remember I'm a blonde) and cover the basic use of C. I'd be glad about suggestions and ideas... my brain and my compiler are yearning for some action!

------------------
C'est à cette amie que je me confie - mais c'est l'autre que j'embrasse...

Offline
Top of Page Profile Contact Info 
 Post Number: 2
chmod Search for posts by this member.
Jedi Knight
Avatar



Group: Members
Posts: 373
Joined: Jul. 2001
PostIcon Posted on: Oct. 24 2001,19:36 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

Once you've got pointers down, you might wanna explore data structures a bit - linked lists, binary trees, etc... They are a pain in the ass but you can learn a lot by playing with them.
What platform do you do all your coding on?
Offline
Top of Page Profile Contact Info 
 Post Number: 3
DeadAnztac Search for posts by this member.
I am almost one of Us.
Avatar



Group: Members
Posts: 0
Joined: Feb. 2001
PostIcon Posted on: Oct. 24 2001,19:38 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

I could pass along some of the assignments we're doing in Computer Science, and if you don't know how to do something, that's cool, we can work it out It's certainly not hard for me (I half teach the class at the moment). Whaddya say? It's something to do

------------------
~Anztac [ Pertinaciously disconsolate ]

Offline
Top of Page Profile Contact Info WEB 
 Post Number: 4
CowboyNeal Search for posts by this member.
FNG
Avatar



Group: Members
Posts: 74
Joined: Jul. 2001
PostIcon Posted on: Oct. 24 2001,20:14 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

Yeah, I could use some exercise...but then I just go see what's on the television..

------------------
I'm a bad little cowboy and I like it.*

*by little i mean huge**

**and by Cowboy I mean fat-ass

Offline
Top of Page Profile Contact Info WEB 
 Post Number: 5
TallAssAzn Search for posts by this member.
FNG
Avatar



Group: Members
Posts: 147
Joined: Nov. 2000
PostIcon Posted on: Oct. 24 2001,21:25 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

I suppose I'll be checking up on this thread too...

<-- needs to learn C, but has no time. HS Sopho. w/ 2x AP classes... Yeah.

------------------
<º(((><

Offline
Top of Page Profile Contact Info 
 Post Number: 6
chmod Search for posts by this member.
Jedi Knight
Avatar



Group: Members
Posts: 373
Joined: Jul. 2001
PostIcon Posted on: Oct. 24 2001,21:31 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

Shit man, I've got 6 AP classes. It actually hasn't been that bad.... yet. But AP computer science is a joke, fortunately the teacher is open-minded enough to let me work on my own stuff. I would insert a rant about that course somewhere, but it seems Chase has already done so. hmph.
Anyways... here's an interesting quiz on C you might wanna try, for shits and giggles: http://www.cprogramming.com/cgi-bin/quiz.cgi
Offline
Top of Page Profile Contact Info 
 Post Number: 7
damien_s_lucifer Search for posts by this member.
Emperor of Detnet
Avatar



Group: Members
Posts: 33
Joined: Jan. 1970
PostIcon Posted on: Oct. 25 2001,02:19 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

liney - think of something that needs a simple database - a personal phone book or something. Then implement a B-tree and use it to hold your data. That will teach you a lot about two of the most useful programming topics, pointers and recursion.

If you're interested let me know & I'll type up one of my famous Lectures detailing how a B-tree works.

You have to email me a picture of you though

Question #2
Which of the following is evaluated first:
a) &&
b) | |
c) !

My answer : Probably ! because it's a unary operator. But who the fuck cares? Real programmers don't bother memorizing operator precedence. They just parenthesize everything

Offline
Top of Page Profile Contact Info WEB 
 Post Number: 8
@$$h0l3 Search for posts by this member.
FNG
Avatar



Group: Members
Posts: 40
Joined: Dec. 2000
PostIcon Posted on: Oct. 25 2001,03:31 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

If you want something that will teach you more about designing an algorithm than coding, try the towers of Hannoy (sp?) problem. Properly implemented, it should only be a handful of lines, but you must think long and hard before you code to get the recursion right (at least when you are starting to code).

The problem: You have three pegs, two are empty, and one has x number of disks stacked on it. The disks are stacked with the largest disk on the bottom and the smallest on top. You goal is to move all the disks from one peg to another, but there are rules.
1) you can only move one disk at time.
2)you cannot put a larger disk on top of a smaller one.
Sometimes there's a third rule, but I don't remember it.

I believe when I took <don't laugh> Pascal </don't laugh> back in the old days, the completed program was ~ 20 lines long, including variable declarations, begin..end statements and the main program. But it took me a while to figure it out, and it's a very tidy exercise in recursion. When you see it in your head for like x=64 rings, it's quite cool.

Offline
Top of Page Profile Contact Info 
 Post Number: 9
LiNeY Search for posts by this member.
Lady of DetNet
Avatar



Group: Members
Posts: 782
Joined: Dec. 2000
PostIcon Posted on: Oct. 25 2001,15:18 Skip to the previous post in this topic. Skip to the next post in this topic. Ignore posts   QUOTE

quote:
Originally posted by damien_s_lucifer:
If you're interested let me know & I'll type up one of my famous Lectures detailing how a B-tree works.

You have to email me a picture of you though

Question #2
Which of the following is evaluated first:
a) &&
b) | |
c) !

My answer : Probably ! because it's a unary operator. But who the fuck cares? Real programmers don't bother memorizing operator precedence. They just parenthesize everything


My answer: Probably ! because it's unary, but who the fuck cares? Real women don't bother memorizing operator precendence. They copy the table listing all of 'em in order out of the book and keep it handy!

I'd love to get that lecture about the B-Tree. If you email it to me, I'll send you a pic in return.

Oh and btw guys... can anyone help me with this little problem? I have never written programs which store data or make files or something, i.e. as soon as I close the program, everything's gone... What do I have to do?

It sucks to be a lam0r... a blonde lam0r...

------------------
C'est à cette amie que je me confie - mais c'est l'autre que j'embrasse...

Offline
Top of Page Profile Contact Info 
 Post Number: 10
damien_s_lucifer Search for posts by this member.
Emperor of Detnet
Avatar



Group: Members
Posts: 33
Joined: Jan. 1970
PostIcon Posted on: Oct. 25 2001,19:37 Skip to the previous post in this topic.  Ignore posts   QUOTE

LiNeY - you need to store your data in a file. Any good C book should have a section on reading in / writing out files.

File I/O is pretty simple... basically you use functions that work exactly like printf() and scanf() except they take another argument called a filehandle so they know which file you're talking about

Maybe we should start with file I/O before getting into B-trees. B-trees aren't all that interesting if you can't read and write files.

Also, what OS are you programming in?

This message has been edited by damien_s_lucifer on October 26, 2001 at 02:38 PM

Offline
Top of Page Profile Contact Info WEB 
13 replies since Oct. 24 2001,19:26 < Next Oldest | Next Newest >

[ Track This Topic :: Email This Topic :: Print this topic ]


Page 1 of 212>>
reply to topic new topic new poll

» Quick Reply C programming exercise
iB Code Buttons
You are posting as:

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code