Got time?

I

iamedd

I have taken a class for C and a class for C++, yet when I read through
some code, I am seriously lacking. I have tried to read countless
tutorial from numerous different sites and I even read my books, but
there is something missing. I need some guidance. The tutorials
aren't enough. I could use someone who could help me by letting me
know WHICH tutorials to read and giving me tasks to complete.

Anyone?
 
D

dandelion

iamedd said:
I have taken a class for C and a class for C++, yet when I read through
some code, I am seriously lacking. I have tried to read countless
tutorial from numerous different sites and I even read my books, but
there is something missing. I need some guidance. The tutorials
aren't enough. I could use someone who could help me by letting me
know WHICH tutorials to read and giving me tasks to complete.

Anyone?

Don't *read* code. Write it, test it, change it and C what happens. Start
yourself up with sime relatively easy task and progress from there.

1. Write a program to count characters in a ASCII text.

2. Write a program to count words in a ASCII text.

3. Write a program to count lines in a ASCII text.
 
E

Emmanuel Delahaye

iamedd wrote on 28/12/04 :
I have taken a class for C and a class for C++, yet when I read through
some code, I am seriously lacking. I have tried to read countless
tutorial from numerous different sites and I even read my books, but
there is something missing. I need some guidance. The tutorials
aren't enough. I could use someone who could help me by letting me
know WHICH tutorials to read and giving me tasks to complete.

Obviously, you need practice. Have you done the execrices of the K&R ?

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Clearly your code does not meet the original spec."
"You are sentenced to 30 lashes with a wet noodle."
-- Jerry Coffin in a.l.c.c++
 
M

Mike Wahler

iamedd said:
I can do the exercises, but then how will I know how well I've done?

Post the exercises and your solutions, and ask for
comments and criticism.

-Mike
 
I

infobahn

dandelion said:
Don't *read* code. Write it, test it, change it and C what happens. Start
yourself up with sime relatively easy task and progress from there.

1. Write a program to count characters in a ASCII text.

2. Write a program to count words in a ASCII text.

3. Write a program to count lines in a ASCII text.

Why drag ASCII into it?
 
F

Flash Gordon

Better ideas?

Text. It matters not what encoding is used. In fact, doing it properly
for ASCII is harder because the system might not use ASCII so you can't
use library functions such as isspace.
 
I

infobahn

iamedd said:
Better ideas?

1. Write a program to count characters in a text.

2. Write a program to count words in a text.

3. Write a program to count lines in a text.

See what I mean?
 
I

iamedd

infobahn said:
1. Write a program to count characters in a text.

2. Write a program to count words in a text.

3. Write a program to count lines in a text.

See what I mean?
Should that be three seperate programs or one combined?
 
I

iamedd

infobahn said:
1. Write a program to count characters in a text.

2. Write a program to count words in a text.

3. Write a program to count lines in a text.

See what I mean?
Should that be three seperate programs or one combined?
 
I

infobahn

iamedd said:
Should that be three seperate programs or one combined?

Personally, I think the student should decide, since it'll be
good exercise.

Just for reference, the unix utility, wc, combines all three
facilities in a single program.
 
I

italy

Hi iamedd,

When you say "read", it makes me think you're just trying to know what
the program does, rather than _why_ it does what it does. I think you
should change your attitude with learning. Typically what I find with
students entering college (in general, of course) is they don't know
how to learn correctly. Learning is a skill that requires practice!
Rather than just knowing what something does, ask yourself questions.
If you do this, you will certainly learn it correctly, and learning it
correctly the first time is certainly an advantage by itself. Good
luck.

-Adam Roan
 
R

Richard Bos

dandelion said:
To keep it simple.

You do realise that by requiring ASCII, rather than the text
representation natural to the underlying system, you've actually made
the problem a lot less simple, don't you?

Richard
 
D

dandelion

Just for reference, the unix utility, wc, combines all three
facilities in a single program.

Where do you think i got the idea? Besides, it's a nice and easy way for the
OP to validate his/her work.
 
D

dandelion

Richard Bos said:
You do realise that by requiring ASCII, rather than the text
representation natural to the underlying system, you've actually made
the problem a lot less simple, don't you?

Yes.. Although i find 'a lot less' something of an exaggeration.

However, the assignment calls for comparisons of only a limited number of
values to check (spaces, newlines) and i'm not asking for character
conversion. I put in ASCII (7 bit) to prevent the student to take the easy
route and use 'isspace()', 'isprint()' and such. First write one yourself.
Should not be that hard, especially when restricted to only 128 symbols.

Besides, many encoding schemes (notably UTF-8 and ISO) have ASCII as a
subset and for UTF-16/UCS-2 (where you have to wonder about endianness) it's
the same.
 
I

infobahn

dandelion said:
Yes.. Although i find 'a lot less' something of an exaggeration.

I'd be interested to see your solution, then. :)
However, the assignment calls for comparisons of only a limited number of
values to check (spaces, newlines) and i'm not asking for character
conversion. I put in ASCII (7 bit) to prevent the student to take the easy
route and use 'isspace()', 'isprint()' and such. First write one yourself.
Should not be that hard, especially when restricted to only 128 symbols.

Besides, many encoding schemes (notably UTF-8 and ISO) have ASCII as a
subset and for UTF-16/UCS-2 (where you have to wonder about endianness) it's
the same.

But some character sets (notably EBCDIC) do not have ASCII as a subset.
So, to write the program(s) you suggest in full generality, you would
have to hard-code ASCII codes into the program, at the very least.

Also, on a note unrelated to ASCII, you failed to define "word". Not
a terrible omission, since it will cause the OP to think hard about
what is meant by the word "word" - an excellent exercise in itself. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,157
Messages
2,570,879
Members
47,414
Latest member
djangoframe

Latest Threads

Top