dev-cpp-users Mailing List for Dev-C++ (Page 620)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: chromatonus 7. <chr...@ho...> - 2002-02-18 01:09:37
|
hi, thank you for your previous help, but i have another problem...
I keep receiving this error and i don't know what it means:
passing `int' to argument 2 of `pic(node *, int *, int)' lacks a cast
Thank you for your help,
#include <iostream.h>
#include <stdlib.h>
#include <conio.h>
struct node
{
int data;
node *left, *right;
};
//================================ PROTOTYPES
==================================
int menu();
//postcondition: creates and displays a menu, returning the value of
choice
void create( node *&, int );
void insert_node(node *&, node*);
void pre( node* );
void in( node* );
void post( node* );
void pic( node*, int[63], int );
int two_exp(int);
int make_array( node* );
int size( node* );
int menu()
{
int choice;
cout<< "TREE EDITOR MENU OPTIONS" << "\n";
cout<< "1. Insert elements in Tree" << "\n";
cout<< "2. Display Tree in Prefix" << "\n";
cout<< "3. Display Tree in Infix" << "\n";
cout<< "4. Display Tree in Postfix" << "\n";
cout<< "5. Display Tree Diagram" << "\n";
cout<< "6. Balance Tree" << "\n";
cout<< "7. Exit";
gotoxy(1,10);
cout<< "choice? ";
cin>> choice;
return(choice);
}
//=============================== Main Program
=================================
int main()
{
node *root = NULL;
int choice, info, s;
choice = menu();
while( choice != 7 )
{
switch( choice )
{
case 1: gotoxy(1,12);
cout<< "input? ";
cin>> info;
node *stem;
create( stem, info );
insert_node(root, stem);
break;
case 2: gotoxy(1,15);
cout<< "Prefix: ";
pre( root );
break;
case 3: gotoxy(1,17);
cout<< "Infix: ";
in( root );
break;
case 4: gotoxy(1,19);
cout<< "Postfix: ";
post( root );
break;
case 5: clrscr();
s = size( root );
pic( root, make_array(root), s );
break;
case 6:
break;
}
gotoxy(1,10);
cout<< "choice? ";
cin>> choice;
}
}
void create( node *& stem, int info )
{
stem = new node;
stem->data = info;
stem->left = NULL;
stem->right = NULL;
}
void insert_node(node *&root, node *stem)
{
if(root == NULL)
{
root = stem;
}
else
{
if(stem->data < root->data)
insert_node(root->left, stem);
else
insert_node(root->right, stem);
}
}
void pre(node *root)
{
if( root != NULL )
{
cout<< root->data << " ";
pre( root->left );
pre( root->right );
}
}
void in(node *root)
{
if( root != NULL )
{
in(root->left);
cout<< root->data <<" ";
in(root->right);
}
}
void post(node *root)
{
if(root != NULL)
{
post(root->left);
post(root->right);
cout<< root->data <<" ";
}
}
int two_exp(int k)
{
int i, s = 1;
for(i=0; i<=k; i++)
s = 2*s;
return s;
}
int make_array( node* root )
{
int n = 0, array[63];
if( root != NULL )
{
array[n] = root->data;
n++;
pre( root->left );
pre( root->right );
}
return array[63];
}
int size( node* root )
{
int i = 0, array[63];
if( root != NULL )
{
array[i] = root->data;
i++;
pre( root->left );
pre( root->right );
}
return i;
}
//trying to display the tree in a visual form on the screen
void pic(node *root, int array[], int i)
{
int x=33, y=2, j, lev = 4;
node *track = new node;
track = root;
track->left = NULL;
track->right = NULL;
gotoxy(x,y);
cout<< array[0];
for(j=0; j<=i; j++)
{
while((track != NULL) && (array[j+1] < array[j]))
{
x = x-two_exp(lev);
y = 2*y;
gotoxy(x,y);
cout<< array[j+1];
track = track->left;
lev--;
}
while((track != NULL) && (array[j+1] >= array[j]))
{
x = x+two_exp(lev);
y = 2*y;
gotoxy(x,y);
cout<< array[j+1];
track = track->right;
lev--;
}
if((track = NULL) && (array[j+1] < array[j]) )
{
x = x-two_exp(lev);
y = 2*y;
gotoxy(x,y);
cout<< array[j+1];
track = root;
lev = 4;
}
if((track = NULL) && (array[j+1] >= array[j]) )
{
x = x+two_exp(lev);
y = 2*y;
gotoxy(x,y);
cout<< array[j+1];
track = root;
lev = 4;
}
}
}
P.S. any suggestions on how to "balance" the tree? (trying to display all
the same elements, but arrange them in such a way as to minimize the # of
levels in the tree) Thank you!
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
|
|
From: Malcolm <alb...@ic...> - 2002-02-17 23:13:03
|
Brilliant, thanks for the quick reply Colin, I'll tell them all. Malcolm. --------- ----- Original Message ----- From: "Colin Laplace" <col...@wa...> To: <dev...@li...> Sent: Sunday, February 17, 2002 11:04 PM Subject: Re: [Dev-C++] Mirror to download DevC++ ?? > Hello, > > bloodshed.net has exceeded its bandwidth quota for this month. > I am in the process of moving to another web hosting company. I hope the > downtime won't take more than 3 days other days. > Otherwise, there is a mirror available at http://www.haikuzone.org > > Greetings, > Colin Laplace |
|
From: Jason H. <jas...@bt...> - 2002-02-17 23:07:10
|
I suspect that there will be a way to retrieve such information through Windows, as windows does have a set of Motherboard Drivers, so it would probably involve the use of such drivers. MSDN would probably be a good source for info about that. Jason. ----- Original Message ----- From: "Ioannis Vranos" <no...@ya...> To: "Dev-C++" <dev...@li...> Sent: Sunday, February 17, 2002 2:53 PM Subject: RE: [Dev-C++] Fan > Look how you can call windows system information and retrieve > information from it using win32/mfc and if SI doesn't have this you can > search to web for the keywords "how to retrieve bios fan speed > information programming" or something. You may need to use assembly. > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.d2g.com > * Alternative URL: http://run.to/noicys > > > > -----Original Message----- > > From: Stein Nygard [mailto:ste...@ge...] > > Sent: Sunday, February 17, 2002 2:13 PM > > To: Ioannis Vranos > > Subject: SV: [Dev-C++] Fan > > > > > > Ahh... sounds perfect! So, where can I read more about this? > > It would be really cool if I could make a program that could > > read the fanspeed etc.! *G* > > > > - stein > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Colin L. <col...@wa...> - 2002-02-17 23:05:23
|
Hello, bloodshed.net has exceeded its bandwidth quota for this month. I am in the process of moving to another web hosting company. I hope the downtime won't take more than 3 days other days. Otherwise, there is a mirror available at http://www.haikuzone.org Greetings, Colin Laplace On Sunday 17 February 2002 23:49, you wrote: > Hi, > I have recommended DevC++ to some pals but > the download site is not available, reporting quota exceeded for the month. > I guess there must have been too many recomendations ! ho! popular > compiler > > :-) > > Does this mean that they must wait till March ? > Is there a mirror site anywhere ? > > I still have my downloaded devcpp4.zip that I downloaded on 18/08/2001 > would it be correct/ok for me to offer that to them or would > I be contravening a licence or anything ? > Anyway, I think there has been a new version out since then ? > > Thanks for any guide or info, > Malcolm. > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Malcolm <alb...@ic...> - 2002-02-17 22:51:27
|
Hi, I have recommended DevC++ to some pals but the download site is not available, reporting quota exceeded for the month. I guess there must have been too many recomendations ! ho! popular compiler :-) Does this mean that they must wait till March ? Is there a mirror site anywhere ? I still have my downloaded devcpp4.zip that I downloaded on 18/08/2001 would it be correct/ok for me to offer that to them or would I be contravening a licence or anything ? Anyway, I think there has been a new version out since then ? Thanks for any guide or info, Malcolm. |
|
From: <ste...@ge...> - 2002-02-17 22:21:37
|
Hi fellow-coders!
I'm using
PlaySound("mysound.wav", NULL, SND_FILENAME | SND_ASYNC);
to play a rather large audiofile. The problem is that when I run my
application straight after a reboot, the soundplaying is delayed. If then
run my app again, the sound plays nice 'n tight. I assume this i bacause the
sound has to be loaded, and a program usually loads faster the second time
you run it.
Is there a way, that I can escape from this sad effect?
Thanks!
- stein
|
|
From: Bob C. <rc...@ps...> - 2002-02-17 22:08:55
|
----- Original Message -----
From: "Bob Campbell" <rc...@ps...>
To: "Rashan Jibowu" <re...@ho...>
Sent: Sunday, February 17, 2002 5:08 PM
Subject: Re: [Dev-C++] A Couple of Questions
> Hi,
>
> > 1. How do I clear the screen (MS-DOS) before each time I run, or re-run
a
> > program?
>
>
> One way to clear the screen is to use system("cls");
>
>
> > 2. How do I use libraries in a C++ program?
>
>
> Each library has its own way of doing things. You can download and try
> different libraries... some include tutorials.
> You can also read up on things like the <iostream> library to see how it
is
> used and how you #include it in your programs.
>
>
>
> > 3. Why would a programmer want several separate source files to be
> compiled
> > into one program? Why not just keep all of the source code in one file?
>
>
> Just look at the complexity of some applications and think what it would
be
> like if the source was not broken up, organized, and used only when
needed.
> Imagine being stuck in a mall where there no walls separating the stores
or
> walls to separate departments within individual stores... utter chaos. And
> if you are a parent, hell on earth...
>
> Bob
>
>
>
>
|
|
From: Rashan J. <re...@ho...> - 2002-02-17 21:03:50
|
Hey Fellow Dev C++ Users: I have a couple of questions. Perhaps you can help me with them. 1. How do I clear the screen (MS-DOS) before each time I run, or re-run a program? 2. How do I use libraries in a C++ program? 3. Why would a programmer want several separate source files to be compiled into one program? Why not just keep all of the source code in one file? I look forward to your help, ~ Razmattaz _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
|
From: Ioannis V. <no...@ya...> - 2002-02-17 17:33:33
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Devin Carless
> Sent: Sunday, February 17, 2002 6:47 PM
> To: dev...@li...
> Subject: Re: [Dev-C++] 'New Source File' bug
>
>
> Oh, I know. They're wonderful-looking things. I'm
> currently only using them as fancy dynamic arrays.
> But while you can do a lot with vectors, vectors can do a
> lot with you. I had Vec.size() in a conditional, and the
> conditional consistently got it wrong. It worked, however,
> when I replaced
> Vec.size() with a variable, Size, which had been intialized to
> Vec.size() a line before.
> That's only one reason I'm very cautious with vectors.
This is broken compiler. Did it happen with MINGW32?
Although i did not see any code, value wrapping may had occured.
E.g.
for(int i=0; i<Vec.size(); i++)
{ ...}
When variable i reached the maximum int value it may wrapped around
(according to the standard it is undefined behavior).
The correct & safe synatx is assuming Vec to be vector<int>:
for(vector<int>::size_type i=0; i<Vec.size(); i++)
{ ...}
> > Anyway i think it is our lack of knowledge, not vectors.
> When i finish
> > the 16th chapter i will resend an email telling you how you can to
> > assignments using vector constructors.
>
> There's a saying that goes 'It's a poor workman who blames
> his tools.' And many times it's been my mistake; I'm a poor
> workman. But there are other times when I've caught
> something funny going on. (push_back() refusing to work was
> one of them.)
This is broken implementation issue.
> > I am confident that standard containers are better than built in
> > arrays.
>
> Absolutely true: the reason I'm using vectors is because
> arrays are /worse./ The only thing I think arrays have to
> recommend them is that they can be intialized like so:
>
> char* frogs[4] = { "Green", "Tree", "Bull", "Muppet" };
>
> (Yes, I know char* is frowned upon, but I've found some
> interesting traps trying to initialize a string to a string
> constant of the form "Blah" when passed as an argument.)
> For my project, in which certain subclasses have great
> tracts of constant data, this kind of initialization would be ideal.
I am working using standard containers all the time and never
encountered any problem (except that MING doesn't support vector::at()
).
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.d2g.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2002-02-17 17:33:33
|
vector is container of the C++ standard library aimed to replace built in arrays. Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Daniel Glenfield Sent: Sunday, February 17, 2002 6:50 PM To: dev...@li... Subject: Re: [Dev-C++] vectors I thought vecotrs were only used with graphics? Can you use them at other times? |
|
From: Daniel G. <sp...@ho...> - 2002-02-17 16:49:55
|
<html><div style='background-color:'><DIV>
<P>I thought vecotrs were only used with graphics? Can you use them at other times?<BR><BR></P></DIV>
<DIV></DIV>
<DIV></DIV>>From: "Devin Carless" <DCC...@YA...>
<DIV></DIV>>To: <DEV...@LI...>
<DIV></DIV>>Subject: Re: [Dev-C++] 'New Source File' bug
<DIV></DIV>>Date: Sun, 17 Feb 2002 11:46:47 -0500
<DIV></DIV>>
<DIV></DIV>> > I currently have little knowledge of the standard library and i am
<DIV></DIV>> > currrently learning about it (currently reading 16 chapter of TC++PL
<DIV></DIV>> > Special Edition). But with as many as i know so far you can do many
<DIV></DIV>> > things with vectors:
<DIV></DIV>>
<DIV></DIV>> Oh, I know. They're wonderful-looking things. I'm currently only
<DIV></DIV>>using them as fancy dynamic arrays.
<DIV></DIV>> But while you can do a lot with vectors, vectors can do a lot with
<DIV></DIV>>you. I had Vec.size() in a conditional, and the conditional
<DIV></DIV>>consistently got it wrong. It worked, however, when I replaced
<DIV></DIV>>Vec.size() with a variable, Size, which had been intialized to
<DIV></DIV>>Vec.size() a line before.
<DIV></DIV>> That's only one reason I'm very cautious with vectors.
<DIV></DIV>>
<DIV></DIV>> > Anyway i think it is our lack of knowledge, not vectors. When i finish
<DIV></DIV>> > the 16th chapter i will resend an email telling you how you can to
<DIV></DIV>> > assignments using vector constructors.
<DIV></DIV>>
<DIV></DIV>> There's a saying that goes 'It's a poor workman who blames his tools.'
<DIV></DIV>>And many times it's been my mistake; I'm a poor workman. But there
<DIV></DIV>>are other times when I've caught something funny going on. (push_back()
<DIV></DIV>>refusing to work was one of them.)
<DIV></DIV>>
<DIV></DIV>> > I am confident that standard containers are better than built in arrays.
<DIV></DIV>>
<DIV></DIV>> Absolutely true: the reason I'm using vectors is because arrays are
<DIV></DIV>>/worse./ The only thing I think arrays have to recommend them is that
<DIV></DIV>>they can be intialized like so:
<DIV></DIV>>
<DIV></DIV>> char* frogs[4] = { "Green", "Tree", "Bull", "Muppet" };
<DIV></DIV>>
<DIV></DIV>> (Yes, I know char* is frowned upon, but I've found some interesting
<DIV></DIV>>traps trying to initialize a string to a string constant of the form "Blah"
<DIV></DIV>>when passed as an argument.)
<DIV></DIV>> For my project, in which certain subclasses have great tracts of
<DIV></DIV>>constant data, this kind of initialization would be ideal.
<DIV></DIV>>
<DIV></DIV>> > You can overload an operator as a global function
<DIV></DIV>> > e.g.
<DIV></DIV>> > vector<INT> &operator=(vector<INT>&a, const vector<INT> &b)
<DIV></DIV>> > { ... }
<DIV></DIV>>
<DIV></DIV>> Thank you :)
<DIV></DIV>>
<DIV></DIV>> > or better define it as a template:
<DIV></DIV>> >
<DIV></DIV>> > template <CLASS T>
<DIV></DIV>> > vector<T> &operator=(vector<T> &a, const vector<T> &b)
<DIV></DIV>> > { ... }
<DIV></DIV>>
<DIV></DIV>> Templates I'm somewhat wary of; I'll deal with them when I have
<DIV></DIV>>to. Until then I'll stick with learning the ins and outs of what I /do/
<DIV></DIV>>know.
<DIV></DIV>>
<DIV></DIV>> > Yes, me too. But C++ is 10000% better. I suggest "The C++ Programming
<DIV></DIV>> > Language" 3rd edition or Special Edition by Bjarne Stroustrup (the
<DIV></DIV>> > creator of C++).
<DIV></DIV>>
<DIV></DIV>> Unfortunately, that's beyond my resources. I don't have the money and the
<DIV></DIV>>demand in the university/city library for books that teach C++ is total.
<DIV></DIV>>I've
<DIV></DIV>>only managed to scrounge the texts I'm working with by good fortune.
<DIV></DIV>> And despite what I might say, C++ is 10,000% better. Partially, I think,
<DIV></DIV>>because the old Kernighan and Ritchie paradigm of 'only stupid people make
<DIV></DIV>>mistakes - are you a stupid person?' has been replaced by the strong-type-
<DIV></DIV>>checking 'Everyone makes mistakes, we'll help you catch them' theory.
<DIV></DIV>>
<DIV></DIV>> > It is better. :)
<DIV></DIV>>
<DIV></DIV>>You've said it three times now - it must be true!
<DIV></DIV>>
<DIV></DIV>>--Devin Carless
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>_________________________________________________________
<DIV></DIV>>Do You Yahoo!?
<DIV></DIV>>Get your free @yahoo.com address at http://mail.yahoo.com
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>_______________________________________________
<DIV></DIV>>Dev-cpp-users mailing list
<DIV></DIV>>Dev...@li...
<DIV></DIV>>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
<DIV></DIV></div><br clear=all><hr>Join the worlds largest e-mail service with MSN Hotmail. <a href='http://go.msn.com/bql/hmtag4_etl_EN.asp'>Click Here</a><br></html>
|
|
From: Devin C. <dcc...@ya...> - 2002-02-17 16:43:23
|
> I currently have little knowledge of the standard library and i am
> currrently learning about it (currently reading 16 chapter of TC++PL
> Special Edition). But with as many as i know so far you can do many
> things with vectors:
Oh, I know. They're wonderful-looking things. I'm currently only
using them as fancy dynamic arrays.
But while you can do a lot with vectors, vectors can do a lot with
you. I had Vec.size() in a conditional, and the conditional
consistently got it wrong. It worked, however, when I replaced
Vec.size() with a variable, Size, which had been intialized to
Vec.size() a line before.
That's only one reason I'm very cautious with vectors.
> Anyway i think it is our lack of knowledge, not vectors. When i finish
> the 16th chapter i will resend an email telling you how you can to
> assignments using vector constructors.
There's a saying that goes 'It's a poor workman who blames his tools.'
And many times it's been my mistake; I'm a poor workman. But there
are other times when I've caught something funny going on. (push_back()
refusing to work was one of them.)
> I am confident that standard containers are better than built in arrays.
Absolutely true: the reason I'm using vectors is because arrays are
/worse./ The only thing I think arrays have to recommend them is that
they can be intialized like so:
char* frogs[4] = { "Green", "Tree", "Bull", "Muppet" };
(Yes, I know char* is frowned upon, but I've found some interesting
traps trying to initialize a string to a string constant of the form "Blah"
when passed as an argument.)
For my project, in which certain subclasses have great tracts of
constant data, this kind of initialization would be ideal.
> You can overload an operator as a global function
> e.g.
> vector<int> &operator=(vector<int>&a, const vector<int> &b)
> { ... }
Thank you :)
> or better define it as a template:
>
> template <class T>
> vector<T> &operator=(vector<T> &a, const vector<T> &b)
> { ... }
Templates I'm somewhat wary of; I'll deal with them when I have
to. Until then I'll stick with learning the ins and outs of what I /do/
know.
> Yes, me too. But C++ is 10000% better. I suggest "The C++ Programming
> Language" 3rd edition or Special Edition by Bjarne Stroustrup (the
> creator of C++).
Unfortunately, that's beyond my resources. I don't have the money and the
demand in the university/city library for books that teach C++ is total.
I've
only managed to scrounge the texts I'm working with by good fortune.
And despite what I might say, C++ is 10,000% better. Partially, I think,
because the old Kernighan and Ritchie paradigm of 'only stupid people make
mistakes - are you a stupid person?' has been replaced by the strong-type-
checking 'Everyone makes mistakes, we'll help you catch them' theory.
> It is better. :)
You've said it three times now - it must be true!
--Devin Carless
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|
|
From: Ioannis V. <no...@ya...> - 2002-02-17 14:53:39
|
Look how you can call windows system information and retrieve information from it using win32/mfc and if SI doesn't have this you can search to web for the keywords "how to retrieve bios fan speed information programming" or something. You may need to use assembly. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: Stein Nygard [mailto:ste...@ge...] > Sent: Sunday, February 17, 2002 2:13 PM > To: Ioannis Vranos > Subject: SV: [Dev-C++] Fan > > > Ahh... sounds perfect! So, where can I read more about this? > It would be really cool if I could make a program that could > read the fanspeed etc.! *G* > > - stein |
|
From: Ioannis V. <no...@ya...> - 2002-02-17 12:01:26
|
These are system extensions. It depends on whether a system provides that information, and if it does you will retrieve them either via calls to the OS API or directly accessing certain parts of memory (e.g. BIOS area) specific to your system. Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Stein Nyg=E5rd > Sent: Sunday, February 17, 2002 1:40 PM > To: DevCpp > Subject: [Dev-C++] Fan >=20 >=20 > I was just wondering... Is it difficult to retrieve info on=20 > motherboardstuff like, how fast the fans are going, current=20 > cpu-clock etc.? What knowledge is aquired to do it? >=20 > - stein >=20 >=20 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >=20 |
|
From: <ste...@ge...> - 2002-02-17 11:40:23
|
I was just wondering... Is it difficult to retrieve info on motherboardstuff like, how fast the fans are going, current cpu-clock etc.? What knowledge is aquired to do it? - stein |
|
From: Ioannis V. <no...@ya...> - 2002-02-16 20:21:38
|
<http://run.to/noicys> -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Hardman Sent: Saturday, February 16, 2002 9:58 PM To: Dev-C++ Subject: Re: [Dev-C++] student needs a little help The trick is to tailor your method of accessing the data to the type and quantity of data and the access speeds needed. In the store example a few thousand records wouldn't be unreasonable, and each record would be on average no more than 30 bytes each (roughly). Say you did have 10000 record at 50 bytes (adding space for list implementation etc...), that's 500,000 bytes, in other words just less than 500kb (say half a meg). On the scale of current memory usage that's pretty miniscule. There are cases where it's impracticle to use memory and you have to use disk stored systems, and there are a range of specialised algorithms for dealing with them, but on the whole most developers would just use a Database system for large scale data storage and retrieval. Another factor to account for is the fact that most OS's have a virtual memory ability, so in effect if you do load a large quantity of data into memory it will be be automaticaly placed into a disk storage system, and it saves you a lot of complex work on disk access algorithms. Also by ordering a list of records into a predictable sequence you allow for the use of special searching algorithms, as aposed to the basic sequential search. What you use is yet again dependent upon scale and speed requirement. However there are whole volumes dedicated to this one subject alone so I won't go into detail here. At a guess anything up to a couple of hundred megabytes is good for memory storage (dependent upon the OS and target system in use), and above that a more advanced data access system should be considered. Also of note is that memory has somewhere on a scale of 1000 times quicker access speeds than current disk technology. After saying all that a linked list wouldn't be a perfect solution because it's not the fasted model, a tree would be more suited, but they all follow the same principal. Searching through 10000 records in a linked list in memory wouldn't take more than a few seconds either (at a guess). Maybe you didn't want to know all that, but I think it's an interesting subject. Jason. Of course i wanted to know. :) Well basically you didn't tell me anything new than those i was imagining but it's an interesting topic anyway. As for searching it depends what search you want, how the data are sorted when they are stored e.t.c.. For example if you care searching by ID and the data are stored in ID sequence, then you can implement very fast data location detection and retrieval. So we agree on small database systems we can use linked lists, e.t.c. and consider space/time trade offs. On large database systems perhaps some tricks encapsulated in the list, e.g. caching/disk retrieval combination. Thanks for sharing your opinion. Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys |
|
From: Jason H. <jas...@bt...> - 2002-02-16 19:58:53
|
MessageThe trick is to tailor your method of accessing the data to the = type and quantity of data and the access speeds needed. In the store = example a few thousand records wouldn't be unreasonable, and each record = would be on average no more than 30 bytes each (roughly). Say you did = have 10000 record at 50 bytes (adding space for list implementation = etc...), that's 500,000 bytes, in other words just less than 500kb (say = half a meg). On the scale of current memory usage that's pretty = miniscule. There are cases where it's impracticle to use memory and you = have to use disk stored systems, and there are a range of specialised = algorithms for dealing with them, but on the whole most developers would = just use a Database system for large scale data storage and retrieval. = Another factor to account for is the fact that most OS's have a virtual = memory ability, so in effect if you do load a large quantity of data = into memory it will be be automaticaly placed into a disk storage = system, and it saves you a lot of complex work on disk access = algorithms. Also by ordering a list of records into a predictable sequence you allow = for the use of special searching algorithms, as aposed to the basic = sequential search. What you use is yet again dependent upon scale and = speed requirement. However there are whole volumes dedicated to this one = subject alone so I won't go into detail here. At a guess anything up to a couple of hundred megabytes is good for = memory storage (dependent upon the OS and target system in use), and = above that a more advanced data access system should be considered. Also = of note is that memory has somewhere on a scale of 1000 times quicker = access speeds than current disk technology. After saying all that a linked list wouldn't be a perfect solution = because it's not the fasted model, a tree would be more suited, but they = all follow the same principal. Searching through 10000 records in a = linked list in memory wouldn't take more than a few seconds either (at a = guess). Maybe you didn't want to know all that, but I think it's an interesting = subject. Jason. ----- Original Message -----=20 From: Ioannis Vranos=20 To: Dev-C++=20 Sent: Saturday, February 16, 2002 4:22 PM Subject: RE: [Dev-C++] student needs a little help I am really with short programming experience (i have been programming = since 2000) and i can't understand how we can use linked lists on a = large scale program. E.g. imagine we have a datafile with 10000 records. = We load all of them in memory in a linked list so as to sort them on the = fly e.t.c.? In few words the question is how can we apply a linked list = in many records? Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... = [mailto:dev...@li...] On Behalf Of Benjamin = Wheeless Sent: Saturday, February 16, 2002 3:40 PM To: dev...@li... Subject: RE: [Dev-C++] student needs a little help In my opinion, what he uses is really up to him, whether that be a = container, or forcing it through with brutish, inefficient code, or = using your suggestion and sticking with the data file as his container. The only reason that I suggested linked lists is due to the fact = that he (1) is a student and his professor probably gave him the = assignment in hopes that he would figure out basic data structure = techniques, while at the same time showing some initiative and = creativity in solving the problem and (2) because a question was posed = directly concerning linked lists and where to find more information on = them. There is nothing "wrong" with any of these approaches that have been = suggested. It is really up to him and his comfort level and knowledge = base that he currently has with the language. Wouldn't you agree? Benjamin Wheeless Network Systems - Delta Airlines, Inc. Atlanta, GA - USA 30320 |
|
From: Jack Y. <jy...@tw...> - 2002-02-16 19:18:05
|
Hello,
I cannot get my program to work with HTMLHelp. I have linked to the
HtmlHelp.lib and included the htnlhelp header file. I have the call
HtmlHelp (GetDeskTopWindow(),
path:\my.chm,
HH_DISPLAY_TOPIC, 0);
in my program. path:\my.chm refers to a valid path and chm file. I have
used fin.open() to open the file so I know the path is valid. I can open
the chm from windows so the file is good. But no matter what I try it will
not open from my program. I asked on one of the c lists thinking I was
making a mistake with the syntax but it appears I am not. So that seems to
leave only Dev-C++. Has anyone added help to a program using this package?
Jack
--
E-Mail: jy...@tw...
Alt: jy...@vo...
Home: http://my.voyager.net/~jyork
|
|
From: Ioannis V. <no...@ya...> - 2002-02-16 16:48:57
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Devin Carless
> Sent: Saturday, February 16, 2002 6:20 PM
> To: dev...@li...
> Subject: Re: [Dev-C++] 'New Source File' bug
>
> >
> > What trouble.
>
> Initializing an array/vector of objects, of which some of the
> members are consts. That was my first problem. My second
> was push_back() decided to stop working. (This led me to
> look somewhat askance at vectors, and I still see them as
> exceedingly finicky things.) Initializing a vector to anything
> interesting including constants without using push_back() is
> difficult; I ultimately solved the problem by ripping out almost
> every const in my project (not without some satisfaction)
> and using a Set() function. (I implemented a rudimentary
I currently have little knowledge of the standard library and i am
currrently learning about it (currently reading 16 chapter of TC++PL
Special Edition). But with as many as i know so far you can do many
things with vectors:
const vector<int>::size_type SIZE=100;
vector<int>array(SIZE);
for(vector<int>::size_type i==0; i<SIZE; i++)
array[i]=...;
Anyway i think it is our lack of knowledge, not vectors. When i finish
the 16th chapter i will resend an email telling you how you can to
assignments using vector constructors.
> sort of data protection by only allowing anything to be
> changed if the Name member was set to the constant
> NULLSTR.)
> I've also had problems initializing vectors from arrays.
> Vectors can be initialized in a wonderful panoply of ways,
> all of which are thoroughly useless for my purposes. It's
> recently occurred to me that this is probably a job for an
> overloaded assignment operator. I'm not certain how to
> do this for a vector (while vectors are finicky, templates are
> just plain sticky, and I haven't read much about them
> because I don't expect to need them for a while.)
I am confident that standard containers are better than built in arrays.
You can overload an operator as a global function
e.g.
vector<int> &operator=(vector<int>&a, const vector<int> &b)
{ ... }
or better define it as a template:
template <class T>
vector<T> &operator=(vector<T> &a, const vector<T> &b)
{ ... }
> Most of my problems, I can see, stem from the fact that
> I learned (and loved) C long before ever setting eyes on
> C++.
Yes, me too. But C++ is 10000% better. I suggest "The C++ Programming
Language" 3rd edition or Special Edition by Bjarne Stroustrup (the
creator of C++).
>(My first reaction to C++ was 'They've turned
> something beautiful into a hideous bloated beast.') So I
No it is better.
> despise references with a hate the KKK can only dream of
> achieving, find consts to be a pain in the colon that extends
> all the way up the intestines, and find C++ is excessively
> schoolmarmish about initialization. (Don't get me wrong - I
> adore classes, inheritance,
> polymorphism and even strong typing. On the whole,
> it's a much better language.
It is better. :)
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.d2g.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2002-02-16 16:22:11
|
I am really with short programming experience (i have been programming since 2000) and i can't understand how we can use linked lists on a large scale program. E.g. imagine we have a datafile with 10000 records. We load all of them in memory in a linked list so as to sort them on the fly e.t.c.? In few words the question is how can we apply a linked list in many records? Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Benjamin Wheeless Sent: Saturday, February 16, 2002 3:40 PM To: dev...@li... Subject: RE: [Dev-C++] student needs a little help In my opinion, what he uses is really up to him, whether that be a container, or forcing it through with brutish, inefficient code, or using your suggestion and sticking with the data file as his container. The only reason that I suggested linked lists is due to the fact that he (1) is a student and his professor probably gave him the assignment in hopes that he would figure out basic data structure techniques, while at the same time showing some initiative and creativity in solving the problem and (2) because a question was posed directly concerning linked lists and where to find more information on them. There is nothing "wrong" with any of these approaches that have been suggested. It is really up to him and his comfort level and knowledge base that he currently has with the language. Wouldn't you agree? Benjamin Wheeless Network Systems - Delta Airlines, Inc. Atlanta, GA - USA 30320 |
|
From: Devin C. <dcc...@ya...> - 2002-02-16 16:16:55
|
> Be patient, Dev-C++ 5 is coming. Good. :) Though, bugs aside, I rather like Dev-C++ 4. > > I'm having enough > > trouble with C++'s noodleheaded view of aggregate data > > objects; this really isn't helping. > > > What trouble. Initializing an array/vector of objects, of which some of the members are consts. That was my first problem. My second was push_back() decided to stop working. (This led me to look somewhat askance at vectors, and I still see them as exceedingly finicky things.) Initializing a vector to anything interesting including constants without using push_back() is difficult; I ultimately solved the problem by ripping out almost every const in my project (not without some satisfaction) and using a Set() function. (I implemented a rudimentary sort of data protection by only allowing anything to be changed if the Name member was set to the constant NULLSTR.) I've also had problems initializing vectors from arrays. Vectors can be initialized in a wonderful panoply of ways, all of which are thoroughly useless for my purposes. It's recently occurred to me that this is probably a job for an overloaded assignment operator. I'm not certain how to do this for a vector (while vectors are finicky, templates are just plain sticky, and I haven't read much about them because I don't expect to need them for a while.) Most of my problems, I can see, stem from the fact that I learned (and loved) C long before ever setting eyes on C++. (My first reaction to C++ was 'They've turned something beautiful into a hideous bloated beast.') So I despise references with a hate the KKK can only dream of achieving, find consts to be a pain in the colon that extends all the way up the intestines, and find C++ is excessively schoolmarmish about initialization. (Don't get me wrong - I adore classes, inheritance, polymorphism and even strong typing. On the whole, it's a much better language. --Devin Carless (Wow. I didn't plan on ranting that much.) _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
|
From: Jason H. <jas...@bt...> - 2002-02-16 13:54:29
|
MessageIt says in the specification that you should read in the data = file, and suggests a list would be the best data structure to use. If = you were modelling on real world use you would want as much data as = possible in memory to allow speedy searches. An orderd list or some = similar container type would provide a fast and flexible system for data = storage and retrieval. Jason. ----- Original Message -----=20 From: Ioannis Vranos=20 To: Dev-C++=20 Sent: Saturday, February 16, 2002 4:11 AM Subject: RE: [Dev-C++] student needs a little help Why should he use any container at all? His "container" in the = particular case is the data file. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... = [mailto:dev...@li...] On Behalf Of Benjamin = Wheeless Sent: Saturday, February 16, 2002 5:57 AM To: dev...@li... Subject: Re: [Dev-C++] student needs a little help I would agree with Jason on using a map, but then again...if the = assignment is for you to develop a linked list implementation, then you = need to research linked lists. You are going to want to have a good = grasp of pointers before you start, so if you are rusty on pointers you = need to start there. I used to know of a really good sight that explained several = interesting data structures, including linked lists, but I cannot find = the link right now. I did find this one, that does give some code snippets which should = get you started: http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp If you need more information, I would recommend going to = http://www.google.com and doing a search on linked lists. You'll be = amazed at how much is actually out there. Hope that helps you out. Benjamin Wheeless Network Systems - Delta Airlines, Inc. Atlanta, GA - USA 30320 = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D |
|
From: Benjamin W. <ben...@ho...> - 2002-02-16 13:40:14
|
<html><div style='background-color:'><DIV> <P>In my opinion, what he uses is really up to him, whether that be a container, or forcing it through with brutish, inefficient code, or using your suggestion and sticking with the data file as his container.</P> <P>The only reason that I suggested linked lists is due to the fact that he (1) is a student and his professor probably gave him the assignment in hopes that he would figure out basic data structure techniques, while at the same time showing some initiative and creativity in solving the problem and (2) because a question was posed directly concerning linked lists and where to find more information on them.</P> <P>There is nothing "wrong" with any of these approaches that have been suggested. It is really up to him and his comfort level and knowledge base that he currently has with the language. Wouldn't you agree?</P> <P><FONT face="Geneva, Arial, Sans-serif" size=2>Benjamin Wheeless<BR></FONT><FONT face="Geneva, Arial, Sans-serif" size=2><STRONG>Network Systems - Delta Airlines, Inc.<BR></STRONG></FONT><FONT face=Arial size=2><STRONG>Atlanta, GA - USA 30320<BR></STRONG></FONT><FONT face=Arial size=2><STRONG>==============================</STRONG></FONT></P></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>----Original Message Follows---- <DIV></DIV>From: "Ioannis Vranos" <NO...@YA...> <DIV></DIV>To: "Dev-C++" <DEV...@LI...> <DIV></DIV>Subject: RE: [Dev-C++] student needs a little help <DIV></DIV>Date: Sat, 16 Feb 2002 06:11:44 +0200 <DIV></DIV> <DIV></DIV>Why should he use any container at all? His "container" in the <DIV></DIV>particular case is the data file. <DIV></DIV> <DIV></DIV> <DIV></DIV>Ioannis <DIV></DIV> <DIV></DIV>* Ioannis Vranos <DIV></DIV>* Programming pages: <DIV></DIV>http://www.noicys.d2g.com <DIV></DIV>* Alternative URL: http://run.to/noicys <DIV></DIV> <DIV></DIV> <DIV></DIV>-----Original Message----- <DIV></DIV>From: dev...@li... <DIV></DIV>[mailto:dev...@li...] On Behalf Of Benjamin <DIV></DIV>Wheeless <DIV></DIV>Sent: Saturday, February 16, 2002 5:57 AM <DIV></DIV>To: dev...@li... <DIV></DIV>Subject: Re: [Dev-C++] student needs a little help <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>I would agree with Jason on using a map, but then again...if the <DIV></DIV>assignment is for you to develop a linked list implementation, then you <DIV></DIV>need to research linked lists. You are going to want to have a good <DIV></DIV>grasp of pointers before you start, so if you are rusty on pointers you <DIV></DIV>need to start there. <DIV></DIV> <DIV></DIV>I used to know of a really good sight that explained several interesting <DIV></DIV>data structures, including linked lists, but I cannot find the link <DIV></DIV>right now. <DIV></DIV> <DIV></DIV>I did find this one, that does give some code snippets which should get <DIV></DIV>you started: <DIV></DIV>http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp <DIV></DIV> <DIV></DIV>If you need more information, I would recommend going to <DIV></DIV>http://www.google.com and doing a search on linked lists. You'll be <DIV></DIV>amazed at how much is actually out there. <DIV></DIV> <DIV></DIV>Hope that helps you out. <DIV></DIV> <DIV></DIV>Benjamin Wheeless <DIV></DIV>Network Systems - Delta Airlines, Inc. <DIV></DIV>Atlanta, GA - USA 30320 <DIV></DIV>============================== <DIV></DIV> <DIV></DIV></div><br clear=all><hr>Send and receive Hotmail on your mobile device: <a href='http://go.msn.com/bql/hmtag2_etl_EN.asp'>Click Here</a><br></html> |
|
From: Ioannis V. <no...@ya...> - 2002-02-16 04:11:53
|
Why should he use any container at all? His "container" in the particular case is the data file. Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Benjamin Wheeless Sent: Saturday, February 16, 2002 5:57 AM To: dev...@li... Subject: Re: [Dev-C++] student needs a little help I would agree with Jason on using a map, but then again...if the assignment is for you to develop a linked list implementation, then you need to research linked lists. You are going to want to have a good grasp of pointers before you start, so if you are rusty on pointers you need to start there. I used to know of a really good sight that explained several interesting data structures, including linked lists, but I cannot find the link right now. I did find this one, that does give some code snippets which should get you started: http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp If you need more information, I would recommend going to http://www.google.com and doing a search on linked lists. You'll be amazed at how much is actually out there. Hope that helps you out. Benjamin Wheeless Network Systems - Delta Airlines, Inc. Atlanta, GA - USA 30320 ============================== |
|
From: Benjamin W. <ben...@ho...> - 2002-02-16 03:56:57
|
<html><div style='background-color:'><P>I would agree with Jason on using a map, but then again...if the assignment is for you to develop a linked list implementation, then you need to research linked lists. You are going to want to have a good grasp of pointers before you start, so if you are rusty on pointers you need to start there.</P> <P>I used to know of a really good sight that explained several interesting data structures, including linked lists, but I cannot find the link right now.</P> <P>I did find this one, that does give some code snippets which should get you started:<BR><A href="http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp">http://www.inquiry.com/techtips/cpp_pro/10min/10min0599.asp</A></P> <P>If you need more information, I would recommend going to <A href="http://www.google.com">http://www.google.com</A> and doing a search on linked lists. You'll be amazed at how much is actually out there.</P> <P>Hope that helps you out.</P> <DIV></DIV> <DIV><FONT face="Geneva, Arial, Sans-serif" size=2>Benjamin Wheeless</FONT></DIV> <DIV></DIV> <DIV><FONT face="Geneva, Arial, Sans-serif" size=2><STRONG>Network Systems - Delta Airlines, Inc.</STRONG></FONT></DIV> <DIV></DIV> <DIV><FONT face=Arial size=2><STRONG>Atlanta, GA - USA 30320</STRONG></FONT></DIV> <DIV></DIV> <DIV><FONT face=Arial size=2><STRONG>==============================</STRONG></FONT></DIV> <DIV> </DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>----Original Message Follows---- <DIV></DIV>From: "Jason Hardman" <JAS...@BT...> <DIV></DIV>To: "Dev-C++" <DEV...@LI...> <DIV></DIV>Subject: Re: [Dev-C++] student needs a little help <DIV></DIV>Date: Fri, 15 Feb 2002 23:16:34 -0000 <DIV></DIV> <DIV></DIV>Hi, <DIV></DIV> <DIV></DIV>List structures are usualy taught early on in a programming course you may need to tell your teacher that you haven't yet been taught lists though? You may want to clarify whether you have to make your own list data type or if you can use a standardly available one. C++ defines a standard set of container objects that should be readily available in any up to date C++ distro, called the Standard Template Library (STL), and list is one of them. I would actualy use a map (also available in the STL) to implement the grocery list though. A map is a series <KEY><VALUE>combinations, where you can look up a <VALUE>using the <KEY>part. The STL also defines a range of access and search methods for you. However you may not be allowed to rely on ready made parts, although in the real world you would. <DIV></DIV> <DIV></DIV>My best advise for you would be to arrange to talk to the teacher and ask about these things, because it would take a lot of effort to teach you about lists in a single e-mail. Books usualy have a whole chapter on them and how to use them. Try researching Algorithms and Abstract Data Types. There are probably some web-sites around that cover the subject too, anyone know any? <DIV></DIV> <DIV></DIV>Jason. <DIV></DIV>----- Original Message ----- <DIV></DIV>From: Marton Rusk <DIV></DIV>To: dev...@li... <DIV></DIV>Sent: Friday, February 15, 2002 10:23 PM <DIV></DIV>Subject: [Dev-C++] student needs a little help <DIV></DIV> <DIV></DIV> <DIV></DIV>Hello Everyone, <DIV></DIV> <DIV></DIV>I'm currently a CS Student and need a little help. I have been given the enclosed programming assignment but I'm not sure how to do it. It seems like a simple problem to solve but I don't know how to do list let and from the looks of the problem it will need one. I guess the teacher things we are supposed to know how to do list already. <DIV></DIV> <DIV></DIV>Anyhow, I'd like a few pointers on how to do this problem if possible. Maybe how to do the part of the code where it would require a list and search. <DIV></DIV> <DIV></DIV>Any help is appreciated, thanks. <DIV></DIV> <DIV></DIV>Marton <DIV></DIV> <DIV></DIV> <DIV></DIV>Program #2: Grocery Store Checkout (60 points) <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>Your assignment is to write, run, and test a C++ program, pg2, to simulate the operation of a <DIV></DIV> <DIV></DIV>grocery store checkout system. Your program should first build a data structure to contain <DIV></DIV> <DIV></DIV>information on all the products available in the store. Then the program should print the cash <DIV></DIV> <DIV></DIV>register receipt for each customer. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>INPUT <DIV></DIV> <DIV></DIV>The input for pg2 has two sources: the inventory information is input from a text file, <DIV></DIV> <DIV></DIV>and the customer transactions are input from the keyboard. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>1. The information about each product carried by the store is listed on a single line in the <DIV></DIV> <DIV></DIV>inventory file "invent.dat", in the following format: <DIV></DIV> <DIV></DIV><PRODUCT number><DESCRIPTION><PRICE><TAX> <DIV></DIV> <DIV></DIV>where <PRODUCT number>is a five-digit positive (nonzero) integer, <DESCRIPTION>is a string of <DIV></DIV> <DIV></DIV>at most 12 characters with no embedded blanks, <PRICE>is a real number, and <TAX>is a <DIV></DIV> <DIV></DIV>character ('T' if the product is taxable; 'N' if it is not taxable). The data in the inventory file is <DIV></DIV> <DIV></DIV>ordered from smallest to largest product number. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>2. The customer transactions are input from the keyboard, in the following format: <DIV></DIV> <DIV></DIV><PRODUCT number><TIMES> <DIV></DIV> <DIV></DIV>where <PRODUCT number>is as described above, and <TIMES>is an integer in the range 1 to 100, <DIV></DIV> <DIV></DIV>indicating the quantity of this product desired. A zero input for <PRODUCT number>indicates the <DIV></DIV> <DIV></DIV>end of the customer's order. (The store will soon be using a scanner to input the product number, <DIV></DIV> <DIV></DIV>but for now it is typed in by the cashier.) <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>OUTPUT <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>The program outputs should be written to a text file called "receipts.out", which can be printed <DIV></DIV> <DIV></DIV>out for purposes of determining your grade. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>1. The inventory information of invent.dat is echo printed to the output file. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>2. The cash register receipt for each customer is written to the output file. The receipts should be <DIV></DIV> <DIV></DIV>nicely formatted, with the product description (not the product number), number of items, item <DIV></DIV> <DIV></DIV>price, and total price for each product printed on a single line. At the end of each customer's <DIV></DIV> <DIV></DIV>order, the subtotal for all items, amount of tax on taxable items, and total bill should be printed, <DIV></DIV> <DIV></DIV>clearly labeled. (The tax rate is 7.5% for taxable items.) <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>PROCESSING <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>pg2 first reads in all of the inventory information from file invent.dat, echo printing the <DIV></DIV> <DIV></DIV>information to the output file receipts.out. The program then prompts the cashier to begin inputting <DIV></DIV> <DIV></DIV>the order for the first customer. This customer's order is processed, and the receipt is printed to the <DIV></DIV> <DIV></DIV>output file. <DIV></DIV> <DIV></DIV>After each customer's order is processed, the program should ask the cashier if another customer is <DIV></DIV> <DIV></DIV>to be processed. If the answer is 'Y', the program sets up to process the next customer; if the answer <DIV></DIV> <DIV></DIV>is 'N', the program terminates with a friendly message. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>ERROR CHECKING <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>The following input errors are possible and should be handled by pg2 <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>1. Duplicate <PRODUCT number>in inventory file. Write an error message to the output file and skip <DIV></DIV> <DIV></DIV>the second entry. <DIV></DIV> <DIV></DIV>2. <PRODUCT number>not in inventory file. Write an error message on the receipt, ignore that product <DIV></DIV> <DIV></DIV>number, and continue with the next item. <DIV></DIV> <DIV></DIV>3. <TIMES>not in the specified range. Write an error message to the output file, ignore that line, and <DIV></DIV> <DIV></DIV>continue with the next item. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>EXAMPLE <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>. From File "Invent.in": <DIV></DIV> <DIV></DIV>11012 gallon-milk 1.99 N <DIV></DIV> <DIV></DIV>11014 butter 2.59 N <DIV></DIV> <DIV></DIV>11110 pie-shells 0.99 N <DIV></DIV> <DIV></DIV>20115 laundry-soap 3.60 T <DIV></DIV> <DIV></DIV>30005 homestyle-br 0.99 N <DIV></DIV> <DIV></DIV>. From keyboard (one customer): <DIV></DIV> <DIV></DIV>11110 2 <DIV></DIV> <DIV></DIV>40012 3 <DIV></DIV> <DIV></DIV>20115 1 <DIV></DIV> <DIV></DIV>0 <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>. To "Receipts.out" file: <DIV></DIV> <DIV></DIV>--------------------------------------------------------- <DIV></DIV> <DIV></DIV>SEP 10, 1998 6:00 pm (* date and time optional *) <DIV></DIV> <DIV></DIV>Customer 1 <DIV></DIV> <DIV></DIV>pie-shells 2 @ 0.99 1.98 <DIV></DIV> <DIV></DIV>*** item 40012 not in inventory *** <DIV></DIV> <DIV></DIV>laundry-soap 1 @ 3.60 3.60 TX <DIV></DIV> <DIV></DIV>Subtotal 5.58 <DIV></DIV> <DIV></DIV>Tax 0.27 <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>Total 5.85 <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>DATA STRUCTURE <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>The inventory information can be stored in a list of product records. Assume that the maximum <DIV></DIV> <DIV></DIV>number of products is 50, for purposes of writing this program. As the data in the inventory file <DIV></DIV> <DIV></DIV>is ordered from smallest to largest product number, it is very simple to insert the product records <DIV></DIV> <DIV></DIV>into this data structure in order. You can use either a sequential or binary search to locate a product <DIV></DIV> <DIV></DIV>number in the inventory. <DIV></DIV> <DIV></DIV>You should specify this data structure as an ADT, as described in the chapter; define and implement <DIV></DIV> <DIV></DIV>a set of operations to encapsulate it. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>TEST PLAN <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>Be sure to include test cases to test your error conditions in your test plan. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>DELIVERABLES <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>1. A disk of the source code of the program pg2 and all included files. <DIV></DIV> <DIV></DIV>2. Hard copy of a listing of your implemented test plan. <DIV></DIV> <DIV></DIV>3. Hard copy of the output file, "receipts.out", produced by running your program using the input <DIV></DIV> <DIV></DIV>specified in your test plan. <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>------------------------------------------------------------------------------ <DIV></DIV>Send and receive Hotmail on your mobile device: Click Here <DIV></DIV>_______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users <DIV></DIV></div><br clear=all><hr>Join the worlds largest e-mail service with MSN Hotmail. <a href='http://go.msn.com/bql/hmtag4_etl_EN.asp'>Click Here</a><br></html> |