Complete.Org: Mailing Lists: Archives: discussion: October 1998:
Re: [aclug-L] C++ ideas...
Home

Re: [aclug-L] C++ ideas...

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: aclug-L@xxxxxxxxxxxx
Subject: Re: [aclug-L] C++ ideas...
From: John Goerzen <jgoerzen@xxxxxxxxxxxx>
Date: 21 Oct 1998 06:26:15 -0500
Reply-to: aclug-L@xxxxxxxxxxxx

Jesse Kaufman <kaufmjes@xxxxxxxxxxxxxxxxx> writes:

> uh...sure...if i ever finish! : ^ )  ... it's a weekend project, and may not
> ever get finished (depends how much time i've got on my hand after class and
> work...  maybe a christmas project! : ^ )

Hehe :-)

> as far as output, i've been using cout and will (once i do some more work on 
> it)
> incorperate the setiosflags() statements and stuff...  i've found them to be
> fairly easy...

You're going to make me dig out my C++ book yet, aren't you :-)

I think that setiosflgas() can do the same sort of things that
printf() can, just in a much more cumbersome manner :-

> linked lists?  what exactly is that?  i realize the problem with arrays, but 
> as

A linked list works like this.

struct A              +---> struct B           +---> struct C
  data                |     data               +     data
  data                |     data               +     data
  pointer to next >---+     pointer to next >---     pointer to next >---+
                                                                         |
                                                                        null
As data must be remembered, space is allocated with malloc() for a new 
struct.  This struct may contain only one data element and one pointer 
in a simple situation.  The pointer for the previously last item in
the list is set to point to the newly-created last element.  The
pointer in the newly-created last element is set to NULL.

To read through the list, one can use code like this:

ptr = start;
while (ptr) {
  /* Do something on the record ptr points to */
  ptr = ptr->next;
}

Note that in C++ this can also be a class, instead of a struct

> far as my c++ knowledge goes (i'm at midterm of my first ever c++ class), that
> seems most logical... better than 50 billion char variables! : ^ )

hehe, yes :-)

> input one line then output?  meaning like (in the final version) input one
> filename, then print that to the output file, then read the next, concat it,
> blah blah blah?

Like this:

1. read a line from the input
2. Process it, mangle it, whatever you must do
3. Write it to the output
4. If there's more input, go back to step 1

This means that the storage requirements are constant: one line.

-- 
John Goerzen   Linux, Unix consulting & programming   jgoerzen@xxxxxxxxxxxx |
Developer, Debian GNU/Linux (Free powerful OS upgrade)       www.debian.org |
----------------------------------------------------------------------------+
Visit the Air Capital Linux Users Group on the web at http://www.aclug.org
---
This is the Air Capitol Linux Users Group discussion list.  If you
want to unsubscribe, send the word "unsubscribe" to
aclug-L-request@xxxxxxxxxxxx.  If you want to post to the list, send your
message to aclug-L@xxxxxxxxxxxx.



[Prev in Thread] Current Thread [Next in Thread]