dev-cpp-users Mailing List for Dev-C++ (Page 369)
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: Smith, J. N. <jn...@ut...> - 2003-06-11 12:14:25
|
Take the arbitrary (non median) dot product of the weights and the scores. Of course, you've defined both "weights" and an "average": this isn't really kosher statistically unless you're assuming the weights represent some sort of oddball fully non-parametric method. I'd suggest Kernighan & Ritchie for C, Stroustrup 2nd Ed. for C++, and Rosenblatt et. al. for an excellent treatment of fully and partially non-parametric and "normal" [that's a math joke] numerical statistics and partial differential equations. -j. -----Original Message----- From: Liezel Joubert [mailto:jou...@ya...] Sent: Wednesday, June 11, 2003 2:15 AM To: dev...@li... Subject: [Dev-C++] Urgent help needed! Hi there, can anyone help with this question? Write a program that computes final averages for a set of grades. The program reads the grades from a file called Scores.dat. The file scores.dat begins with a header line followed by a set of scores for each student. The format of the header line is n weight1 weight2 ... weightn where n is the number of scores for each student and weight is the weight of the score. The header line is followed by grades for each student. The format of a grade line is name score1 score2.... scoren where name is the last name of the student and score is the score. Allscores must be between 0 and 100. The program reads the file score.dat and writes a file called average.dat that has the average computed in it. _____ Do you Yahoo!? Free online <http://us.rd.yahoo.com/mail_us/tag/*http://calendar.yahoo.com> calendar with sync to Outlook(TM). |
|
From: <and...@su...> - 2003-06-11 12:13:29
|
>Message: 2
>From: "Daniel Glenfield" <sp...@ho...>
>To: dev...@li...
>Date: Wed, 11 Jun 2003 08:08:42 +0100
>Subject: [Dev-C++] OT: Can anyone tell me about Cisco (is a course worth
it?)
>
>Hi,
>I have an opportunity to go on one of a choice of introductory courses,
>things like PC Healthcheck, Excel, Visual Basic, and Cisco. I'm wondering
>what Cisco actually is, I know it's related to networking and servers and
>'stuff', but is it worth it (thinking that if it is I could sign up for the
>rest of the course)? Is Cisco a big player these days?
>
>As you can see, I am a bit low on information!
>
>Daniel
Hi Daniel,
Other reply already presented you Cisco. And my message try to cover
another point:
Theese intoductory trainning courses give you important knowledgement
about TCP/IP. Of course most of the time you probably will practice router
configurations, connect some lan (local area network) to another, simulate
some wan(wide area network) communicating to another, etc. Theese aspects
will be more important if you will work with support on networks. But what
is important for you to remember is: Tcp/Ip.
With this aspects of Tcp/Ip studied, you will understand some commands
that we usually do such "netstat", "ping", "tracert", etc. Another aspect
is the possibility to program in Tcp/Ip in Unix. Douglas Comer has a set of
books that gives you several programs written in C for you process
communication between one computer and another in different places.
Regards
Andre
|
|
From: Yeoh H. <ye...@ye...> - 2003-06-11 11:07:35
|
----- Original Message ----- From: "JB Maust" <jb...@so...> To: <dev...@li...> Cc: "Mark Livingstone" <mli...@ip...> Sent: Tuesday, June 10, 2003 2:18 AM Subject: Re: [Dev-C++] Compiling Separately: Separating Code into Modules ... > > My questions are these: > If all of the files are included in the project, shouldn't I just be > able to hit Ctrl-F10 and watch the thing link and compile the files, > and then run? > Sometimes it is better to do a Ctrl-F11 Rebuild all. Best Regards, Yeoh -- |
|
From: Yeoh H. <ye...@ye...> - 2003-06-11 11:07:33
|
----- Original Message -----
From: "Francisco Velez" <fco...@pr...>
To: <dev...@li...>
Sent: Tuesday, June 10, 2003 2:01 PM
Subject: [Dev-C++] problem with 'PlaySound' function
>
> Can someone help me?
>
> I have this piece of code
>
> case WM_CREATE:
> PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME |
SND_ASYNC)
> ;
> return 0 ;
>
> The problem is I recive the follow message from linker
>
> C:\WINDOWS\TEMP\ccdJDcgb.o(.text+0x1e0):hellowin.c: undefined reference to
> `PlaySoundA@12'
>
> I get that the PlaySound funtcion is defined in the LIBWINMM.A file, but I
> can't get the linker use that file.
> ThankYou: Fracisco Velez
>
>
I have a small Dev-C++ project that plays a wav file.
Here's my code which is the same as yours.
PlaySound (TEXT ("Tada.wav"), NULL, SND_FILENAME | SND_SYNC) ;
Have you set the linker options like this?
Project Options -> Parameters ->Linker
-lwinmm
Regards,
Yeoh
~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
ICT eBooks by Yeoh HS
Free Downloads at http://www.yeohhs.com
~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~
|
|
From: Yeoh H. <ye...@ye...> - 2003-06-11 11:07:31
|
----- Original Message ----- From: Liezel Joubert To: dev...@li... Sent: Wednesday, June 11, 2003 3:15 PM Subject: [Dev-C++] Urgent help needed! Hi there, can anyone help with this question? Write a program that computes final averages for a set of grades. The program reads the grades from a file called Scores.dat. The file scores.dat begins with a header line followed by a set of scores for each student. The format of the header line is n weight1 weight2 ... weightn where n is the number of scores for each student and weight is the weight of the score. The header line is followed by grades for each student. The format of a grade line is name score1 score2.... scoren where name is the last name of the student and score is the score. Allscores must be between 0 and 100. The program reads the file score.dat and writes a file called average.dat that has the average computed in it. Hello, This looks like a class assignment but I could be wrong. Anyway, have you started on the program design and pseudocode? And have you tried to write the code in C++? If you have, do post the code so that some of us could help you. It is best that you learn C++ by doing the coding yourself and if you're stuck, post your problem here and I'm sure more people would be glad to help you. Best Regards, Yeoh -- |
|
From: Santiago P. C. <San...@yd...> - 2003-06-11 07:53:07
|
Hi Daniel, CISCO (http://www.cisco.com/) is one of the biggest manufacturers of networking systems (mostly routers running their proprietary OS: Cisco's IOS) in the world, you can find their systems almost everywhere... So you= can think about it a a 'big player' ;o) Hope this helps! Regards, ~Santy -----Original Message----- From: Daniel Glenfield [mailto:sp...@ho...]=20 Sent: mi=E9rcoles, 11 de junio de 2003 9:09 To: dev...@li... Subject: [Dev-C++] OT: Can anyone tell me about Cisco (is a course worth it?) Hi, I have an opportunity to go on one of a choice of introductory courses,=20 things like PC Healthcheck, Excel, Visual Basic, and Cisco. I'm wondering= =20 what Cisco actually is, I know it's related to networking and servers and= =20 'stuff', but is it worth it (thinking that if it is I could sign up for t= he=20 rest of the course)? Is Cisco a big player these days? As you can see, I am a bit low on information! Daniel _________________________________________________________________ Tired of 56k? Get a FREE BT Broadband connection=20 http://www.msn.co.uk/specials/btbroadband ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users -------------------------------------------------------------------------= ------------- This message and any files transmitted with it are confidential and inten= ded solely=20 for the use of the individual or entity to whom they are addressed. No co= nfidentiality=20 or privilege is waived or lost by any wrong transmission.=20 If you have received this message in error, please immediately destroy it= =20and kindly=20 notify the sender by reply email. You must not, directly or indirectly, use, disclose, distribute, print, o= r copy any=20 part of this message if you are not the intended recipient. Opinions, con= clusions and=20 other information in this message that do not relate to the official busi= ness of=20 Ydilo Advanced Voice Solutions, S.A. shall be understood as neither given= =20nor endorsed by it.=20 -------------------------------------------------------------------------= ------------- |
|
From: <qa...@ho...> - 2003-06-11 07:42:23
|
Your teacher maybe? *********** REPLY SEPARATOR *********** On 2003-06-11 at 00:15 Liezel Joubert wrote: Hi there, can anyone help with this question? Write a program that computes final averages for a set of grades. The= program reads the grades from a file called Scores.dat. The file= scores.dat begins with a header line followed by a set of scores for each= student. The format of the header line is n weight1 weight2 ... weightn where n is the number of scores for each student and weight is the weight= of the score. The header line is followed by grades for each student. The= format of a grade line is name score1 score2.... scoren where name is the last name of the student and score is the score.= Allscores must be between 0 and 100. The program reads the file score.dat= and writes a file called average.dat that has the average computed in it. Do you Yahoo!? Free online calendar with sync to Outlook(TM). |
|
From: Ioannis V. <iv...@em...> - 2003-06-11 07:33:17
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Luigi Santillo > Sent: Tuesday, June 10, 2003 6:30 PM > To: 'Dev-Cpp-Users' > Subject: Re: [Dev-C++] Single Linked List-IV > > - using "single pointers", seems not to be correct, in that changes > made to "head" and "tail", are changes made to a copy of > the pointers > local to the function "l_push_back", thus the updated values are > not seen outside the scope of the function. Yes you are right, I did not think a lot. He has to change the pointer values so ** is needed in C, ** or reference (the last using templates) in C++. Well I say some b*llshit from time to time. :) Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Liezel J. <jou...@ya...> - 2003-06-11 07:15:06
|
Hi there, can anyone help with this question? Write a program that computes final averages for a set of grades. The program reads the grades from a file called Scores.dat. The file scores.dat begins with a header line followed by a set of scores for each student. The format of the header line is n weight1 weight2 ... weightn where n is the number of scores for each student and weight is the weight of the score. The header line is followed by grades for each student. The format of a grade line is name score1 score2.... scoren where name is the last name of the student and score is the score. Allscores must be between 0 and 100. The program reads the file score.dat and writes a file called average.dat that has the average computed in it. --------------------------------- Do you Yahoo!? Free online calendar with sync to Outlook(TM). |
|
From: Daniel G. <sp...@ho...> - 2003-06-11 07:08:50
|
Hi, I have an opportunity to go on one of a choice of introductory courses, things like PC Healthcheck, Excel, Visual Basic, and Cisco. I'm wondering what Cisco actually is, I know it's related to networking and servers and 'stuff', but is it worth it (thinking that if it is I could sign up for the rest of the course)? Is Cisco a big player these days? As you can see, I am a bit low on information! Daniel _________________________________________________________________ Tired of 56k? Get a FREE BT Broadband connection http://www.msn.co.uk/specials/btbroadband |
|
From: Luigi S. <gi...@li...> - 2003-06-11 05:43:37
|
> > > On Sat, Jun 07, 2003 at 09:38:34PM +0200, Per Westermark wrote:
> > > [...]
> > >
> > > I know it's a bit extra noisy with dual indirection, but
> > > since the code
> > > is C and not C++, slstore() can't take references to pointers.
> > >
> > > /Per W
> > On Sun, June 08, 2003 9:15 AM +0200, Luigi Santillo wrote:
> > Probably, he could have avoided the double indirection using
> > something like:
> >
> > struct slist
> > {
> > struct address *start;
> > struct address *last;
> > };
> >
> > so that a pointer to "struct slist" would be used, still allowing
> > all changes to "start" and "last" to be made.
> Mon, 9 Jun 2003 06:09:28 +0300 Ioannis Vranos wrote:
> And why use such tricks in the first place and not single pointers?
Well the "trick" I suggest above, reflects my personal C-newbie tastes :-)
I immagine that experienced programmers have more elegant solutions.
However, allow me to say something about the interface of a list
which, for simplicity, has the following two functions:
- push_back = append an element
- pop_front = extract front element
So far, 3 solutions seem to have arisen:
#1: "dual indirection" proposed by Andre' Macario Barros
#2: "list structure" (that is, the newbie "trick" suggested by me)
#3: "single pointers" as I seem to have understood from mail sent
by Ioannis Vranos
Here is a possible way the 3 interfaces might look.
--------------- #1: dual indirection ---------------------
#ifndef list_h
#define list_h
struct l_node
{
void *data; /* address of item to be stored */
struct l_node *next; /* next element on the list */
};
/* add data to the back, return 0 if unable to allocate memory for a
new element, 1 on success */
int
l_push_back(void *data, struct l_node **head_ptr, struct l_node **tail_ptr);
/* pop data from front of a list, return 0 if there is nothing on the
list or pointer stored on the list */
void *
l_pop_front(struct l_node **head_ptr, struct l_node **tail_ptr);
#endif
--------------- #1: end ----------------------------------
---------------- #2: list structure ---------------------
#ifndef list_h
#define list_h
struct l_node
{
void *data; /* address of item to be stored */
struct l_node *next; /* next element on the list */
};
struct list
{
struct l_node *head; /* first node: where pop occurs */
struct l_node *tail; /* last node: where push occurs */
};
/* add data to the back, return 0 if unable to allocate memory for a
new element, 1 on success */
int
l_push_back(void *data, struct list *lptr);
/* pop data from front of a list, return 0 if there is nothing on the
list or pointer stored on the list */
void *
l_pop_front(struct list *lptr);
#endif
---------------- #2: end ---------------------------------
---------------- #3: single pointers ---------------------
#ifndef list_h
#define list_h
struct l_node
{
void *data; /* address of item to be stored */
struct l_node *next; /* next element on the list */
};
/* add data to the back, return 0 if unable to allocate memory for a
new element, 1 on success */
int
l_push_back(void *data, struct l_node *head, struct l_node *tail);
/* pop data from front of a list, return 0 if there is nothing on the
list or pointer stored on the list */
void *
l_pop_front(struct l_node *head, struct l_node *tail);
#endif
---------------- #3: end ---------------------------------
It is clear to me that, upon pushing some data on the list, the
"head" might change while the "tail" will surely change; thus:
- solution proposed by Andre' Macario Barros (dual indirection),
is correct, in fact passing the address of "head" and "tail"
allows changes made by function "l_push_back" to be seen outside
the scope of the function.
- my "trick" (list structure) is correct too, in fact by passing
the address of the list structure and modifying "head" and "tail"
inside function "l_push_back", again changes are seen outside
the scope of the function.
- using "single pointers", seems not to be correct, in that changes
made to "head" and "tail", are changes made to a copy of the pointers
local to the function "l_push_back", thus the updated values are
not seen outside the scope of the function.
Similar reasoning holds for function "l_pop_front".
For the sake of completeness, here are the 3 implementations which
complete the "list" and which I have used for my simple tests.
---------------- #1: dual indirection --------------------
#include <stdlib.h>
#include "list.h"
/********************************************************************/
int
l_push_back(void *data, struct l_node **head_ptr, struct l_node **tail_ptr)
{
struct l_node *nptr = malloc(sizeof(struct l_node));
if (nptr) /* load node and link it */
{
nptr->data = data;
nptr->next = 0; /* new node will be last one */
if (*tail_ptr) /* there is already something */
(*tail_ptr)->next = nptr;
else /* first node */
*head_ptr = nptr;
*tail_ptr = nptr; /* new nodes becomes last one */
return 1;
}
else
return 0;
}
/********************************************************************/
void *
l_pop_front(struct l_node **head_ptr, struct l_node **tail_ptr)
{
void *data = *head_ptr ? (*head_ptr)->data : 0;
if (*head_ptr) /* detach first node */
{
struct l_node *ptr = *head_ptr;
*head_ptr = ptr->next; /* set new head */
free(ptr); /* deallocate memory */
if (*head_ptr == 0) /* there is nothing left */
*tail_ptr = 0; /* reset tail pointer */
}
return data;
}
---------------- #1: end ---------------------------------
---------------- #2: list structure ---------------------
#include <stdlib.h>
#include "list.h"
/********************************************************************/
int
l_push_back(void *data, struct list *lptr)
{
struct l_node *nptr = malloc(sizeof(struct l_node));
if (nptr) /* load node and link it */
{
nptr->data = data;
nptr->next = 0; /* new node will be last one */
if (lptr->tail) /* there is already something */
lptr->tail->next = nptr;
else /* first node */
lptr->head = nptr;
lptr->tail = nptr; /* new nodes becomes last one */
return 1;
}
else
return 0;
}
/********************************************************************/
void *
l_pop_front(struct list *lptr)
{
void *data = (lptr->head) ? lptr->head->data : 0;
if (lptr->head) /* detach first node */
{
struct l_node *ptr = lptr->head;
lptr->head = ptr->next; /* set new head */
free(ptr); /* deallocate memory */
if (lptr->head == 0) /* there is nothing left */
lptr->tail = 0; /* reset tail pointer */
}
return data;
}
---------------- #2: end ---------------------------------
---------------- #3: single pointers ---------------------
#include <stdlib.h>
#include "list.h"
/********************************************************************/
int
l_push_back(void *data, struct l_node *head, struct l_node *tail)
{
struct l_node *nptr = malloc(sizeof(struct l_node));
if (nptr) /* load node and link it */
{
nptr->data = data;
nptr->next = 0; /* new node will be last one */
if (tail) /* there is already something */
tail->next = nptr;
else /* first node */
head = nptr;
tail = nptr; /* new nodes becomes last one */
return 1;
}
else
return 0;
}
/********************************************************************/
void *
l_pop_front(struct l_node *head, struct l_node *tail)
{
void *data = head ? head->data : 0;
if (head) /* detach first node */
{
struct l_node *ptr = head;
head = ptr->next; /* set new head */
free(ptr); /* deallocate memory */
if (head == 0) /* there is nothing left */
tail = 0; /* reset tail pointer */
}
return data;
}
---------------- #3: end ---------------------------------
Finally here are the 3 functions I used to test the "list"
---------------- #1: dual indirection --------------------
#include <stdio.h>
#include "list.h"
static void
print(const struct l_node *head);
int
main()
{
struct l_node *head = 0; /* first element */
struct l_node *tail = 0; /* last element */
int data[] = { 1 , 2, 3, 0 }; /* data */
int *p = 0; /* iterator */
puts("\n\n1) Loading list from back");
for (p = data; *p; p++) /* add another element to the list */
{
printf("\n\npushing value: %d\n", *p);
l_push_back(p, &head, &tail);
print(head);
}
puts("\n\n2) Popping values from front");
while ((p = (int *)l_pop_front(&head, &tail)))
{
printf("\n\npopped value: %d\n", *p);
print(head);
}
return 0;
}
/********************************************************************/
void
print(const struct l_node *head)
{
const struct l_node *iter;
printf("%5s %10s %10s\n", "data", "node", "next");
for (iter = head; iter; iter = iter->next)
{
int *p = (int *)iter->data;
printf("%5d %10p %10p\n", *p, iter, iter->next);
}
}
---------------- #1: end ---------------------------------
---------------- #2: list structure ---------------------
#include <stdio.h>
#include "list.h"
static void
print(const struct list *lptr);
int
main()
{
struct list ls = { 0, 0 }; /* list to be filled */
int data[] = { 1 , 2, 3, 0 }; /* data */
int *p = 0; /* iterator */
puts("\n\n1) Loading list from back");
for (p = data; *p; p++) /* add another element to the list */
{
printf("\n\npushing value: %d\n", *p);
l_push_back(p, &ls);
print(&ls);
}
puts("\n\n2) Popping values from front");
while ((p = (int *)l_pop_front(&ls)))
{
printf("\n\npopped value: %d\n", *p);
print(&ls);
}
return 0;
}
/********************************************************************/
void
print(const struct list *lptr)
{
struct l_node *iter;
printf("%5s %10s %10s\n", "data", "node", "next");
for (iter = lptr->head; iter; iter = iter->next)
{
int *p = (int *)iter->data;
printf("%5d %10p %10p\n", *p, iter, iter->next);
}
}
---------------- #2: end ---------------------------------
---------------- #3: single pointers ---------------------
#include <stdio.h>
#include "list.h"
static void
print(const struct l_node *head);
int
main()
{
struct l_node *head = 0; /* first element */
struct l_node *tail = 0; /* last element */
int data[] = { 1 , 2, 3, 0 }; /* data */
int *p = 0; /* iterator */
puts("\n\n1) Loading list from back");
for (p = data; *p; p++) /* add another element to the list */
{
printf("\n\npushing value: %d\n", *p);
l_push_back(p, head, tail);
print(head);
}
puts("\n\n2) Popping values from front");
while ((p = (int *)l_pop_front(head, tail)))
{
printf("\n\npopped value: %d\n", *p);
print(head);
}
return 0;
}
/********************************************************************/
void
print(const struct l_node *head)
{ /* same implementation of the case #1: "dual indirection" */ }
---------------- #3: end ---------------------------------
Excuse me for the long post and forgive me if I have missed the point
about the "single pointer" approach; at the heart I am a newbie and
have much yet to learn.
Regards
--
>> gisan >>
|
|
From: Per W. <pw...@ia...> - 2003-06-10 10:32:55
|
The compiler always zero-terminate strings if you just give it a chance.
char mystr[] = "foobar";
will store six characters and a termination. It's whey you try
char mystr[6] = "foobar";
that you might get into problems, since the array doesn't allocate space
for a termination. A lot of compilers will complain.
/Per W
On Mon, 9 Jun 2003, CARLSON, JAY MM1 wrote:
> Reply to printing - take 2 - This is a good way to print from a console. A
> file could be created a console program and then printed with a system()
> call. Below is a sample program that demonstrates how it works. It is
> longer than it has to be to show several variations at the same time.
>
> #include <iostream>
> #include <stdlib.h>
>
> using namespace std;
>
> int main(void) {
>
> // assuming c:\test.txt exits, this will work.
> // c:\test.txt should be a small file because it will print 4 times.
> // Notice the double backslash in the first non comment line
> // The backslash is a control characher so the first one
> // is stripped out before the command is executed.
> system("print c:\\test.txt");
> system("PRINT c:\\test.txt");
> system("print C:\\TEST.TXT");
>
> // Other ways to do the same thing.
> // This line could be dangerous - unterminated string
> const char* command01 = "Print C:\\test.txt"; /* do I need \0 ?
> */
> const char* command02 = "Print C:\\test.txt\0"; /* \0 ends the string
> */
> // This line could be dangerous - unterminated string
> const char command03[] = "Print C:\\test.txt"; /* do I need \0 ?
> */
> const char command04[] = "Print C:\\test.txt\0"; /* \0 ends the string
> */
>
> system(command01);
> system(command02);
> system(command03);
> system(command04);
>
>
> // all valid dos commands can by used by system()
> // you can get a list of commands by typing
> // HELP + [enter key] (if installed)
> //
> system("PAUSE");
> // notice case is not important to the system() call
> return 0;
> }
>
> Jay
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Per W. <pw...@ia...> - 2003-06-10 10:26:02
|
It is possible to open lpt1 or prn as a file also. However, depending on what os, driver, printer you have, you might have to fiddle iin the printer settings to make sure that the printer is avavailable in console windows too. Some combinations of OS and printer drivers might not even support text output from a console. /Per W On Mon, 9 Jun 2003, CARLSON, JAY MM1 wrote: > After doing many hours of web surfing. I found the best option for printing > (from a console) is to write everything to a file, then open the file under > notepad, or wordpad and print from there. I guess the reason is GUI's are > so popular (ie Windows), printers need drivers and most are only supplied > with window drivers now, (and linux if your lucky!) It may be possible to > redirect the entire file output to the printer from dos using something like > "c:\filename.exe >> lpt1" or something like that. If anyone has the exact > details that would be great. I also found some information on using inp > outp or inport outport for communicating through various ports. In this way > the printer might be fed some data. But there are just too many unknowns > for me to take a stab at. > > Jay > > > ------------------------------------------------------- > This SF.net email is sponsored by: Etnus, makers of TotalView, The best > thread debugger on the planet. Designed with thread debugging features > you've never dreamed of, try TotalView 6 free at www.etnus.com. > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: escofet <es...@fa...> - 2003-06-10 06:43:28
|
Hi, I'm new to this list but I've been working in C++ using Dev-Cpp for two months. I'd like somebody to tell me how to truncate a file using fstream. Thanks in advanced, Eduardo Escofet |
|
From: Ioannis V. <iv...@em...> - 2003-06-10 06:09:52
|
> My Question: > 1) How to clean stdin using new C++ commands? > > Regards > Andre cin.ignore(200, '\n'); Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Francisco V. <fco...@pr...> - 2003-06-10 06:02:14
|
Can someone help me?
I have this piece of code
case WM_CREATE:
PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC)
;
return 0 ;
The problem is I recive the follow message from linker
C:\WINDOWS\TEMP\ccdJDcgb.o(.text+0x1e0):hellowin.c: undefined reference to
`PlaySoundA@12'
I get that the PlaySound funtcion is defined in the LIBWINMM.A file, but I
can't get the linker use that file.
ThankYou: Fracisco Velez
|
|
From: Luigi S. <gi...@li...> - 2003-06-10 04:57:01
|
On Mon, Jun 09, 2003 at 02:18:16PM -0400, JB Maust wrote: > Mark, > > [...] > > My questions are these: > Does the order of files in the project matter? I have not tested it, but it should not matter > Does the extension have to be .hpp (or is .h OK) for header > files? Both are fine, my personal choice is ".hpp" for C++ and ".h" for C as it helps me tell them apart. > If all of the files are included in the project, shouldn't I just be > able to hit Ctrl-F10 and watch the thing link and compile the files, > and then run? > I do not remember the exact shortcut, but the answer should be yes. Also, header files need not be part of the project as far as compiling is concerned, including them is more a matter of opening those files quickly. -- >> gisan >> |
|
From: CARLSON, J. M. <CA...@st...> - 2003-06-10 04:37:43
|
Reply to printing - take 2 - This is a good way to print from a console. A
file could be created a console program and then printed with a system()
call. Below is a sample program that demonstrates how it works. It is
longer than it has to be to show several variations at the same time.
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(void) {
// assuming c:\test.txt exits, this will work.
// c:\test.txt should be a small file because it will print 4 times.
// Notice the double backslash in the first non comment line
// The backslash is a control characher so the first one
// is stripped out before the command is executed.
system("print c:\\test.txt");
system("PRINT c:\\test.txt");
system("print C:\\TEST.TXT");
// Other ways to do the same thing.
// This line could be dangerous - unterminated string
const char* command01 = "Print C:\\test.txt"; /* do I need \0 ?
*/
const char* command02 = "Print C:\\test.txt\0"; /* \0 ends the string
*/
// This line could be dangerous - unterminated string
const char command03[] = "Print C:\\test.txt"; /* do I need \0 ?
*/
const char command04[] = "Print C:\\test.txt\0"; /* \0 ends the string
*/
system(command01);
system(command02);
system(command03);
system(command04);
// all valid dos commands can by used by system()
// you can get a list of commands by typing
// HELP + [enter key] (if installed)
//
system("PAUSE");
// notice case is not important to the system() call
return 0;
}
Jay
|
|
From: Abhijit S. <mu...@gm...> - 2003-06-10 04:10:41
|
> It may be possible to
> redirect the entire file output to the printer from dos using something
like
> "c:\filename.exe >> lpt1" or something like that.
Actually, that's `prn' in DOS. You can print directly by opening a file
using prn as the name. For example:
ofstream prn("prn");
if(!prn)
{
clog << "Printer not found" << endl;
}
else
{
// Print
prn.close();
}
Or in C, use fopen(), fprintf(), etc.
HTH.
________________________________________
Abhijit Shylanath
http://mudeth.tripod.com/
|
|
From: CARLSON, J. M. <CA...@st...> - 2003-06-10 03:58:26
|
After doing many hours of web surfing. I found the best option for printing (from a console) is to write everything to a file, then open the file under notepad, or wordpad and print from there. I guess the reason is GUI's are so popular (ie Windows), printers need drivers and most are only supplied with window drivers now, (and linux if your lucky!) It may be possible to redirect the entire file output to the printer from dos using something like "c:\filename.exe >> lpt1" or something like that. If anyone has the exact details that would be great. I also found some information on using inp outp or inport outport for communicating through various ports. In this way the printer might be fed some data. But there are just too many unknowns for me to take a stab at. Jay |
|
From: Abhijit S. <mu...@gm...> - 2003-06-09 19:55:53
|
Greets, Andre
-----Original Message-----
Dear users:
A)In C, I am using the following function for cleaning the input buffer:
clean_buffer();
void clean_buffer()
{
while(getchar()!='\n');
}
B)In C++ I thought who made this function was the "endl"
I´ve tested some codes like:
char string[80];
cin >> string; // here I put "hello there"
cout << string; // it prints "hello"
cin >> string // here it passes directly and loads in string
"there"
cout << string; // it prints "there"
...
cin >> string; // I put "hello there" again
cout << string << endl; // I´ve put "endl" expecting to avoid "there"
cin >> string; // it passes directly again :-(
cout << string; // it prints "there" again
My Question:
1) How to clean stdin using new C++ commands?
Regards
Andre
------------------------------
AFAIK, the cout and cin streams are totally independant; they do not share
the buffer. You can try code similar to your stdio:
while(cin.get() != '\n');
Untested, but should work. HTH.
________________________________________
Abhijit Shylanath
http://mudeth.tripod.com/
|
|
From: JB M. <jb...@so...> - 2003-06-09 18:18:51
|
Mark,
thanks for the tip, but that's not the BIG problem. I am following along
with Jesse Liberty's book SAMS Teach Yourself C++ in 10 Minutes. I
understand the return types, but I was just taking the author's source code
from the web site for the book.
I am more of a Java Programmer currently, but I used to use Borland C++
3.1 back in the late 80's/early 90's.
This is specific to the Dev-C++ IDE (which is why I have written to the
list).
** I get 0 (zero) errors when attempting to compile the project or its
individual files. **
I am trying to compile a few files. I have two implementation files with
associated header files, and the main funtion in a separate file. The book
shows the header files with a .h extension and the implementation files with
a .cpp extension.
My questions are these:
Does the order of files in the project matter?
Does the extension have to be .hpp (or is .h OK) for header
files?
If all of the files are included in the project, shouldn't I just be
able to hit Ctrl-F10 and watch the thing link and compile the files,
and then run?
----- Original Message -----
From: "Mark Livingstone" <mli...@ip...>
To: "JB Maust" <jb...@so...>
Sent: Saturday, June 07, 2003 8:30 AM
Subject: Re: [Dev-C++] Compiling Separately: Separating Code into Modules
...
> On Thu, 5 Jun 2003 21:31:41 -0400, you wrote:
>
> > Hello,
> >
> > I am trying to compile a modular program. Is there an order to this
(i.e. if I'm using Borland C++ Compiler at the DOS command prompt I'd have
to compile each file separately, but with Dev C++ 4 (an IDE) I'm not sure.
> >
> > When I try to compile the files separately, I get zero errors but
zero bytes compiled ... what could be wrong?
> >
> > I anybody can explain the procedure to me, I would appreciate it.
>
> Try returning an int rather than a float ;-)
>
> >
> > Below is the main() function "Main.cpp" which refers to the header and
implementation files.
>
>
> > int main(int argc, char* argv[])
> ^^^^^^^^^^^^
> > {
> > SAMSErrorHandling::Initialize();
> >
> > float ReturnCode = 0;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> >
> > try
> > {
> > float Dividend = GetDividend();
> > float Divisor = GetDivisor();
> >
> > cout << Divide(Dividend, Divisor) << endl;
> > }
> > catch (...)
> > {
> > ReturnCode =
> > SAMSErrorHandling::HandleNotANumberError();
> > };
> >
> > SAMSPrompt::PauseForUserAcknowledgement();
> > return ReturnCode;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > }
|
|
From: Ioannis V. <iv...@em...> - 2003-06-09 17:57:38
|
> -----Original Message-----
> From: dev...@li...=20
> [mailto:dev...@li...] On Behalf=20
> Of Andr? Macario Barros
> Sent: Monday, June 09, 2003 7:47 PM
> To: Dev-Cpp-Users
> Subject: [Dev-C++] Escape key sequence
>=20
>=20
> Dear Users,
>=20
> Concerning the Esc escape sequence on the following while,=20
> let me report
> my exact problem:
>=20
> In C, this works:
>=20
> #include <stdio.h>
> #include <stdlib.h>
>=20
> int main()
> {
> char tecla=3D'x';
>=20
> do
> {
> printf(" the key is-->%c\n", tecla);
> }while((tecla =3D getche())!=3D 27);
>=20
> system("pause");
> return 0;
> }
>=20
> I=B4ve changed the getchar by the getche() function and It worked.
>=20
> But, with the following code:
> #include <iostream>
> #include <cstdlib>
> using std::cout;
> using std::endl;
> using std::cin;
> int main()
> {
> char tecla=3D'x';
>=20
> do
> {
> cout << " not escaped yet!!! " << endl;
> }while(tecla =3D cin.get()!=3D 27);
> system("pause");
> return 0;
> }
> --> The behavior of cin.get() seems to me equivalent to=20
> getchar(). And the
> getchar() function stores on the 1st time the caracter and on=20
> the second the
> '\n'. And, it doesn=B4t escape when
> I press the Esc key, ok?
> --> What I need is way to write this second program working=20
> the same way as
> its previous above.
You need unbuffered input (which does not wait for '\n'). This cannot be
done with standard C++ so you have to use a system extension like =
getch() or
getche() as you did.
Ioannis Vranos
=20
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net
|
|
From: Socha, D. F <dav...@us...> - 2003-06-09 17:09:10
|
Me again,
=20
The error that is throwing me off is the error on line 519 where it =
states that there is a syntax error before the '&' token. That line is =
the line that contains "template<typename T> BST& BST<T>::operator=3D =
(const BST& origTree){".
I also don't understand why the compiler is giving me these errors:
bst.h:519: ISO C++ forbids declaration of `operator=3D' with no type
bst.h:519: `int& operator=3D(...)' must be a nonstatic member function
bst.h:519: `int& operator=3D(...)' must take exactly two arguments
I am using Dev C++ 4.9.8.0
Here is a copy of my compile log as well as copies of the code for the =
functions in question=20
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\code\bst\Makefile.win"
Finding dependencies for file: C:\Dev-Cpp\code\bst\bstTester.cpp
Executing make...
make.exe -f "C:\Dev-Cpp\code\bst\Makefile.win" all
g++.exe -c bstTester.cpp -o bstTester.o -I"C:/Dev-Cpp/include/c++" =
-I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" =
-I"C:/Dev-Cpp/include" =20
In file included from bstTester.cpp:13:
bst.h:519: syntax error before `&' token
bst.h:519: `T' was not declared in this scope
bst.h:519: template argument 1 is invalid
bst.h:519: parse error before `&' token
bst.h:519: ISO C++ forbids declaration of `operator=3D' with no type
bst.h:519: `int& operator=3D(...)' must be a nonstatic member function
bst.h:519: `int& operator=3D(...)' must take exactly two arguments
bst.h: In function `int& operator=3D(...)':
bst.h:520: `root' undeclared (first use this function)
bst.h:520: (Each undeclared identifier is reported only once for each =
function=20
it appears in.)
bst.h:520: `origTree' undeclared (first use this function)
bst.h:523: `destroyTree' undeclared (first use this function)
bst.h:526: `orig' undeclared (first use this function)
bst.h:527: `copyTree' undeclared (first use this function)
bst.h:534: invalid use of `this' in non-member function
make.exe: *** [bstTester.o] Error 1
Execution terminated
=20
=20
/************************************************************************=
****
copyTree function
Used by the copy constructor / asignment operator to copy the tree
=20
Sent: pointer to the original node, pointer to the node being copied to
Returns: Nothing
=20
Works by: Creating a new node on the tree being copied, copy the data to =
the
node, checks to see if a left node exists on the tree, if yes
repeat the process using on the left node, if not, do nothing. Then =
checks
the right, if it exists repeat process on the right side, if not, do =
nothing
=20
NOTE: This function is a recursive process
*************************************************************************=
***/
=20
template<typename T> void BST<T>::copyTree(Node* origNode, Node* =
copyNode){
copyNode =3D new Node(origNode->data);
=20
if(origNode->left){
copyTree(origNode->left, copyNode->left);
}
=20
if(origNode->right){
copyTree(origNode->right, copyNode->right);
}
}
//End copyTree
=20
=20
/************************************************************************=
****
Overloaded assignment operator
Used for: assigning the value of one tree to another tree
=20
Sent: A reference to the original tree
Returns: A reference to a tree
=20
Works by: First checking to see if the tree being copyied to has data in =
it.
If it does, the deleteTree function is called to empty the tree/free up =
all the
memory in the tree.
Second, checks to see if the tree being copyied has any data in it. =
If it
does, the copyTree function is called to copy the data from the original =
tree to
the copy tree. If the original tree does not have data on it (root =
=3D=3D NULL)
then the root of the copy tree will be set to null.
*************************************************************************=
***/
=20
=20
template<typename T> BST& BST<T>::operator=3D (const BST& origTree){
if (root !=3D origTree.root){
=20
if(root){
destroyTree(root);
}
=20
if(orig.root){
copyTree(origTree.root, root);
}
else{
root=3DNULL;
}
}
=20
return *this;
}
//End operator=3D
Thanks for all of the help
David Socha
|
|
From: <and...@su...> - 2003-06-09 16:47:08
|
Dear Users,
Concerning the Esc escape sequence on the following while, let me report
my exact problem:
In C, this works:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char tecla='x';
do
{
printf(" the key is-->%c\n", tecla);
}while((tecla = getche())!= 27);
system("pause");
return 0;
}
I´ve changed the getchar by the getche() function and It worked.
But, with the following code:
#include <iostream>
#include <cstdlib>
using std::cout;
using std::endl;
using std::cin;
int main()
{
char tecla='x';
do
{
cout << " not escaped yet!!! " << endl;
}while(tecla = cin.get()!= 27);
system("pause");
return 0;
}
--> The behavior of cin.get() seems to me equivalent to getchar(). And the
getchar() function stores on the 1st time the caracter and on the second the
'\n'. And, it doesn´t escape when
I press the Esc key, ok?
--> What I need is way to write this second program working the same way as
its previous above.
Regards
Andre
|