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? 24 1298
"iamedd" <of****@iamedd.com> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com... 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.
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++
I can do the exercises, but then how will I know how well I've done?
I can do the exercises, but then how will I know how well I've done?
"iamedd" <of****@iamedd.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... 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
dandelion wrote: 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?
infobahn wrote: dandelion wrote: 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?
Better ideas?
"iamedd" <of****@iamedd.com> writes: infobahn wrote: dandelion wrote: > > 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?
Better ideas?
Write code to work with characters in the execution character
set?
--
"Am I missing something?"
--Dan Pop
iamedd wrote: infobahn wrote:
dandelion wrote:
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?
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?
On 28 Dec 2004 09:58:27 -0800
"iamedd" <of****@iamedd.com> wrote: infobahn wrote: dandelion wrote: 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?
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.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
infobahn wrote: iamedd wrote: infobahn wrote:
dandelion wrote:
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?
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?
Should that be three seperate programs or one combined?
infobahn wrote: iamedd wrote: infobahn wrote:
dandelion wrote:
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?
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?
Should that be three seperate programs or one combined?
iamedd wrote: infobahn wrote:
iamedd wrote:
infobahn wrote:
Why drag ASCII into it?
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?
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.
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
"infobahn" <in******@btinternet.com> wrote in message
news:cq**********@sparta.btinternet.com... dandelion wrote: 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?
To keep it simple.
"infobahn" <in******@btinternet.com> wrote in message
news:cq**********@titan.btinternet.com...
<snip> 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.
"dandelion" <da*******@meadow.net> wrote: "infobahn" <in******@btinternet.com> wrote in message news:cq**********@sparta.btinternet.com... dandelion wrote: 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?
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
"Richard Bos" <rl*@hoekstra-uitgeverij.nl> wrote in message
news:41****************@news.individual.net... "dandelion" <da*******@meadow.net> wrote:
"infobahn" <in******@btinternet.com> wrote in message news:cq**********@sparta.btinternet.com... dandelion wrote: > > 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?
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?
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.
dandelion wrote: "Richard Bos" <rl*@hoekstra-uitgeverij.nl> wrote in message news:41****************@news.individual.net...
"dandelion" <da*******@meadow.net> wrote:
"infobahn" <in******@btinternet.com> wrote in message news:cq**********@sparta.btinternet.com...
Why drag ASCII into it?
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?
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. :-)
"infobahn" <in******@btinternet.com> wrote in message
news:cq**********@hercules.btinternet.com... dandelion wrote: "Richard Bos" <rl*@hoekstra-uitgeverij.nl> wrote in message news:41****************@news.individual.net...
"dandelion" <da*******@meadow.net> wrote:
"infobahn" <in******@btinternet.com> wrote in message news:cq**********@sparta.btinternet.com...
>Why drag ASCII into it?
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?
Yes.. Although i find 'a lot less' something of an exaggeration.
I'd be interested to see your solution, then. :-)
When I have time.
<snip> 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.
I don't assume the OP is using EBDIC. I may be wrong, but sofar, i've seen
no indication
this may be the case. You'd have to dig for some pretty outdated hard and
software
AFAIK.
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.
No. It suffices to hardcode '\n', '\r' '\t' and ' '. I'd be satified if the
OP
includes those and impressed if (s)he includes code for 'non-printable'
characters and interpunction characters. Besides, ASCII-tables are a
dime a dozen.
Also, on a note unrelated to ASCII, you failed to define "word".
On purpose.
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. :-)
That's the idea. I'm glad you agree.
dandelion wrote: "infobahn" <in******@btinternet.com> wrote in message news:cq**********@hercules.btinternet.com...
But some character sets (notably EBCDIC) do not have ASCII as a subset.
I don't assume the OP is using EBDIC.
EBCDIC. Neither do I assume it. But I don't assume he's using ASCII
or a superset thereof, either.
I may be wrong, but sofar, i've seen no indication this may be the case. You'd have to dig for some pretty outdated hard and software AFAIK.
Well, not really. IBM mainframes, which are far from outdated, typically
use EBCDIC.
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.
No.
Er, yes, actually.
It suffices to hardcode '\n', '\r' '\t' and ' '.
Indeed. See? Also, on a note unrelated to ASCII, you failed to define "word".
On purpose.
Fair enough.
"infobahn" <in******@btinternet.com> wrote in message
news:cq**********@hercules.btinternet.com...
<snip> I don't assume the OP is using EBDIC. EBCDIC.
Of course. Pray forgive a typo.
Neither do I assume it. But I don't assume he's using ASCII or a superset thereof, either.
I'd place a (modest) bet on that. That includes the ISO encodings,
so chances are (s)he does. I may be wrong, but sofar, i've seen no indication this may be the case. You'd have to dig for some pretty outdated hard
and software AFAIK.
Well, not really. IBM mainframes, which are far from outdated, typically use EBCDIC.
Hmmm...
Somehow I do not find the image of the OP using an IBM mainframe very
convincing... 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.
No.
Er, yes, actually.
> It suffices to hardcode '\n', '\r' '\t' and ' '.
Indeed. See?
I misread thinking you required a full charset to be implemented.
"dandelion" <da*******@meadow.net> wrote: "Richard Bos" <rl*@hoekstra-uitgeverij.nl> wrote in message news:41****************@news.individual.net... "dandelion" <da*******@meadow.net> wrote:
"infobahn" <in******@btinternet.com> wrote in message news:cq**********@sparta.btinternet.com... > Why drag ASCII into it?
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?
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.
Ah - so instead of learning to do the Right Thing, and use the functions
provided in <ctype.h> by every conforming implementation, you suggest
that students get learn to write their own, most likely non-portable,
inefficient replacements. I fail to see why this is advisable.
First write one yourself. Should not be that hard, especially when restricted to only 128 symbols.
No char type is restriced to 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.
And some do not.
Richard
"Richard Bos" <rl*@hoekstra-uitgeverij.nl> wrote in message
<snip> Ah - so instead of learning to do the Right Thing, and use the functions provided in <ctype.h> by every conforming implementation, you suggest that students get learn to write their own, most likely non-portable, inefficient replacements. I fail to see why this is advisable.
It is good practice to implement some of the easier stuff yourself.
Electronics engineers in training start with resistors, capacitors and
transistors instead of complete IC's, latin students start with little,
simple sentences instead of Tacitus Historiae or Annales. Afterwards you can
point out the problems, inefficiencies and non-portabilities. But first let
them have a try at it themselves and see how they do.
Portability is a concept, i would introduce at a later stage. First learn to
do the basics, then worry about all kinds of other issues. Do not drown the
student in detail. Besides, i'd,let the student develop an idea of "The
Right Thing" of his/her own, instead of preaching it as a dogma. The RIght
Thing, after all, is something that flows from the practicalities of
programming, it's not something ordained by Ye Gods of Programming. First write one yourself. Should not be that hard, especially when restricted to only 128 symbols.
No char type is restriced to 128 symbols.
Not the char type. 7 bit ASCII. 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.
And some do not.
True. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bart Nessux |
last post by:
am I doing this wrong:
print (time.time() / 60) / 60 #time.time has been running for many hours
if time.time() was (21600/60) then that would equal 360/60 which would
be 6, but I'm not getting...
|
by: David Stockwell |
last post by:
I'm sure this has been asked before, but I wasn't able to find it.
First off I know u can't change a tuple but if I wanted to increment a time
tuple by one day what is the standard method to do...
|
by: David Graham |
last post by:
Hi
I have asked this question in alt.php as the time() function as used in
setcookie belongs to php - or does it belong equally in the javascript
camp - bit confused about that. Anyway, can anyone...
|
by: Szabolcs Nagy |
last post by:
I have to measure the time of a while loop, but with time.clock i
always get 0.0s, although python manual sais:
"this is the function to use for benchmarking Python or timing
algorithms"
So i...
|
by: Rebecca Smith |
last post by:
Today’s question involves two time text boxes each set to a different time
zone. Initially txtCurrentTime will be set to Pacific Time or system time.
This will change with system time as we travel...
|
by: luscus |
last post by:
Thanks for all the responses on my first question. Unfortunately the
answers I was given were too complicated for my small brain , and
neophite condition to understand. So if you could talk down to...
|
by: cj |
last post by:
If I want to check to see if it's after "11:36 pm" what would I write?
I'm sure it's easy but I'm getting tired of having to work with dates
and times. Sometimes I just want time or date. And...
|
by: davelist |
last post by:
I'm guessing there is an easy way to do this but I keep going around
in circles in the documentation.
I have a time stamp that looks like this (corresponding to UTC time):
start_time =...
|
by: Roseanne |
last post by:
We are experiencing very slow response time in our web app. We run IIS 6 - windows 2003.
I ran iisstate.
Here's what I got. Any ideas??
Opened log file 'F:\iisstate\output\IISState-812.log'...
|
by: Ron Adam |
last post by:
I'm having some cross platform issues with timing loops. It seems
time.time is better for some computers/platforms and time.clock others, but
it's not always clear which, so I came up with the...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |