|
From: Vassili <v.v...@bt...> - 2001-05-29 02:27:40
|
The advice I should've given to the problem, which I totally neglected to
mention, is, if you find that your repeating statements, like all though's
'for else' statements, sit back and think on how you can get a loop to do
all the work for you, don't rush the job. I use to rush. After I sent my
tests in and had a bit of time to think, clearer and better answers would
come to mind. I'd be slapping my forehead and kicking myself, "If I only
waited and thought about it", my marks would have been much better as they
are now.
----- Original Message -----
From: "Vassili" <v.v...@bt...>
To: <dev...@li...>
Sent: Tuesday, May 29, 2001 3:03 AM
Subject: Re: [Dev-C++] BAKERY PROBLEM
> I've just finished a course on 'C' and I'm starting 'C++', the namespace
> thing from what I've read really comes into its own when you start
defining
> your own headers. No there is nothing wrong with using the 'C' headers,
> that's part of the power of C++. It was just me spouting what I've read,
> take no notice of that. In the end your work should reflect what you are
> comfortable with. Also, a big sorry about my earlier reply, I was drunk at
> the time and thought I was being witty. The compiler has laughed at my
work
> also, more than enough times. But its getting better, its hard to grasp
> these things when your starting off on this road and when they sink in,
the
> laughing gets less and less.
> ----- Original Message -----
> From: "Ioannis Vranos" <no...@ya...>
> To: <dev...@li...>
> Sent: Monday, May 28, 2001 10:59 AM
> Subject: RE: [Dev-C++] BAKERY PROBLEM
>
>
> > We are talking about C++.
> >
> > <cstdlib>, <cctype> e.t.c. have the C library functions defined in
> > namespace std. So, if you want to use printf using <cstdio> you should
> > write:
> >
> > #include <cstdio>
> >
> > int main()
> > {
> > using std::printf;
> > // or using namespace std;
> > printf("Hello World!\n");
> > }
> >
> > If you use <stdio.h> e.t.c. you do not need to use the using statement.
> > For example:
> >
> > #include <stdio.h>
> >
> > int main()
> > {
> > printf("Hello World!\n");
> > }
> >
> >
> > The C subset header files of C++ with the .h extension are defined with
> > something like this:
> >
> > --- stdio.h ---
> >
> > #include <cstdio>
> > using std::printf;
> > // ...
> >
> >
> > Now C++ standard library uses only headers without extensions with the
> > need of using statement.
> >
> > For example:
> >
> > #include <iostream> // Correct
> >
> > // ...
> >
> >
> > #include <iostream.h> // Incorrect in ANSI C++ (1998)!
> >
> >
> >
> > Hope this helps.
> >
> > Ioannis
> >
> > * Ioannis Vranos
> > * Programming pages: http://members.nbci.com/noicys
> > * Alternative URL: http://run.to/noicys
> >
> >
> > -----Original Message-----
> > From: dev...@li...
> > [mailto:dev...@li...] On Behalf Of Luigi
> > Santillo
> > Sent: Saturday, May 26, 2001 9:15 PM
> > To: dev...@li...
> > Subject: Re: [Dev-C++] BAKERY PROBLEM
> >
> > Hi,
> > I took a look at Vassili's solution.
> > At the beginning of the (attached) file there are the lines:
> >
> > -----------
> > ...
> > #include <cstdlib>
> > #include <cctype>
> >
> > -----------
> >
> > I would have included the files: stdlib.h and ctype.h instead of cstdlib
> >
> > and cctype.
> >
> > Is there anything wrong with my approach?
> >
> > At 17.42 26/05/01 +0100, you wrote:
> > >----- Original Message -----
> > >From: <mailto:LO5...@ao...>LO5...@ao...
> > >To:
> > ><mailto:dev...@li...>dev...@li...
> > orge.net
> > >
> > >Sent: Friday, May 25, 2001 4:22 PM
> > >Subject: Fwd: [Dev-C++] BAKERY PROBLEM
> > >
> > >#include <iostream.h>
> > >#include <stdlib.h>
> > >const char a = 61;
> > >const int SENNTINEL= -999;
> > >const char SKIP =' ';
> > > ...
> >
> > --
> > gisan
> >
> >
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
> >
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|