dev-cpp-users Mailing List for Dev-C++
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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1
(18) |
2
(3) |
3
(5) |
4
(10) |
5
(2) |
6
(15) |
7
(10) |
8
(17) |
9
(28) |
10
(9) |
11
(20) |
12
(27) |
13
(16) |
14
(2) |
15
(5) |
16
(11) |
17
(6) |
18
(10) |
19
(21) |
20
(24) |
21
(15) |
22
(13) |
23
(26) |
24
(8) |
25
(9) |
26
(11) |
27
(13) |
28
(3) |
29
(4) |
30
(26) |
|
|
|
|
|
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 |
From: Glen V. <gve...@pa...> - 2003-06-09 16:35:13
|
Thanks, this was exactly the reply I was hoping for :) |
From: <or...@vp...> - 2003-06-09 16:13:30
|
Glen Vermeylen wrote: > I noticed my programs are always quite large: > 22.4 kb for an "empty" project, 439 for the standard console application > and I'm instantly at 2mb when using wxWindows. > How can I reduce these sizes? Hehe. 22.4 KB is acceptable, and it won't rise much for simple C console apps. 439 KB is due to the usage of C++ iostream. It introduces huge bloat, which cannot be avoided, only by NOT using it, just simple C I/O (printf and such). Decide yourself what to do. 2MB with wxWindows is due to the fact, that you link statically with wxWindows. A solution would be to use the DLL form of wxwindows, but as far as I know, the DevPak does not contain the wxwindows DLL, nor the import library for it. With the DLL, the size would only be a mere 200 KB or so. Note, that either case, it is unlikely that the program size will increase any further. For all cases, exe size reduction can be achieved, by stripping them. Either supply the -s flag for the *linker*, or type "strip <prog>.exe" at a command prompt (replacing <prog> with your program's name). strip can be found in the bin directory of the MinGW compiler. Other solution might be to use level 4 optimization (-O4) and disabling any sort of debug generation (-g0), which is by default disabled I think (not sure). Specify these for the *compiler*. Another solution is to use an exe compressor. I *highly* recommend UPX, the Ultimate Packer for eXecutables. It is open-source, and very high performance, without *ANY* program speed loss. Visit http://upx.sf.net for details. Download it, place it into a directory, which is accessible from a command prompt (i.e. add that dir to the PATH environment variable), then use this command for best compression: upx -9 <program>.exe With all the above methods I was able to reduce a 2,3 MB wxWindows executable to 427 KB. I hope that helps. Good luck. -- Greetings, Balázs |
From: <eas...@t-...> - 2003-06-09 15:50:57
|
Hello everybody, I have installed libxml package with Dev-C++ 4.9.8.0. But what commands do I have to add into linker options or c++ compiler options to use this library?? Thanks, Martin |
From: Glen V. <gve...@pa...> - 2003-06-09 15:40:26
|
I noticed my programs are always quite large: 22.4 kb for an "empty" project, 439 for the standard console application and I'm instantly at 2mb when using wxWindows. How can I reduce these sizes? Thanks, Glen |
From: Per W. <pw...@ia...> - 2003-06-09 14:34:18
|
The only thing you might check for is of "origTree.root == root". In that case either both trees are empty, or you have done "mytree = mytree;" Without the test, your code would always destroy the tree for the "mytree = mytree;" case. /Per W On Mon, 9 Jun 2003, Socha, David F wrote: > With an assignment operator for a user defined class, a binary Search > Tree class for example, would it be a problem if my overloaded > assignment operator only handled cases where you were assigning one tree > to another. > > Here is some sample code: > > /**************************************************************************** > Overloaded assignment operator > Used for: assigning the value of one tree to another tree > Sent: A reference to the original tree > Returns: A reference to a tree > Works by: First checking to see if the tree bieng 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 == NULL) > then the root of the copy tree will be set to null. > ****************************************************************************/ > > template<typename T> BST& BST<T>::operator= (const BST& origTree){ > if(root){ > destroyTree(root); > } > > if(orig.root){ > copyTree(origTree.root, root); > } > else{ > root=NULL; > } > > return *this; > } > //End operator= > > /**************************************************************************** > copyTree function > Used by the copy constructor / asignment operator to copy the tree > Sent: pointer to the original node, pointer to the node being copied to > Returns: Nothing > 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 > NOTE: This function is a recursive process > ****************************************************************************/ > template<typename T> void BST<T>::copyTree(Node* origNode, Node* copyNode){ > copyNode = new Node(origNode->data); > > if(origNode->left){ > copyTree(origNode->left, copyNode->left); > } > > if(origNode->right){ > copyTree(origNode->right, copyNode->right); > } > } > //End copyTree > > I am using the version 4.9.8.0 of Dev C++ > > Should this work or will I have a problem with this. > Thanks, > David Socha > > > ------------------------------------------------------- > 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: <or...@vp...> - 2003-06-09 13:00:03
|
Krzysztof Kapuscik wrote: > Yes, for sure... And also some problems could happen when mixing stdio > and iostream code because of separated buffering, for example: > > printf (" Something") > cout << " strange"; > printf (" happened"); <= here stdout is flushed > cout << " with the string"; > > could produce: > > Something happened strange with the string > > I don't know if it is regulated by C++ standard, but some compilers > make code with "special effects" described above... I never said to MIX code. I said, use what is simpler for YOU (the original poster). If it works, why the hell ponder for hours on something, that: 1. Does the same 2. More complicated for YOU (NOT Ioannis, NOT Krzysztof or ME) -- Greetings, Balázs |
From: Ioannis V. <iv...@em...> - 2003-06-09 11:40:21
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Krzysztof Kapuscik > Sent: Monday, June 09, 2003 2:10 PM > To: dev...@li... > Subject: Re[2]: [Dev-C++] Cleaning the Input Buffer > > > IV> In the contrary they are simpler, they should not be > slower and make the > IV> program with less lines and more bullet-proof. > > Yes, for sure... And also some problems could happen when mixing stdio > and iostream code because of separated buffering, for example: > > printf (" Something") > cout << " strange"; > printf (" happened"); <= here stdout is flushed > cout << " with the string"; > > could produce: > > Something happened strange with the string > > I don't know if it is regulated by C++ standard, but some compilers > make code with "special effects" described above... The C subset I/O functions use their own buffers (for caching), so printf() has its own cache buffer while cout has its own. 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: Socha, D. F <dav...@us...> - 2003-06-09 11:36:53
|
With an assignment operator for a user defined class, a binary Search = Tree class for example, would it be a problem if my overloaded = assignment operator only handled cases where you were assigning one tree = to another. =20 Here is some sample code: /************************************************************************= **** Overloaded assignment operator Used for: assigning the value of one tree to another tree Sent: A reference to the original tree Returns: A reference to a tree Works by: First checking to see if the tree bieng 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. *************************************************************************= ***/ template<typename T> BST& BST<T>::operator=3D (const BST& origTree){ if(root){ destroyTree(root); } =20 if(orig.root){ copyTree(origTree.root, root); } else{ root=3DNULL; } =20 return *this; } //End operator=3D /************************************************************************= **** copyTree function Used by the copy constructor / asignment operator to copy the tree Sent: pointer to the original node, pointer to the node being copied to Returns: Nothing 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 NOTE: This function is a recursive process *************************************************************************= ***/ 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 I am using the version 4.9.8.0 of Dev C++ =20 Should this work or will I have a problem with this. Thanks, David Socha |
From: Krzysztof K. <sa...@op...> - 2003-06-09 11:08:00
|
Witaj Ioannis, W Twoim licie datowanym 9 czerwca 2003 (12:48:24) mo¿na przeczytaæ: >> -----Original Message----- >> From: dev...@li... >> [mailto:dev...@li...] On Behalf >> Of OROSZI Balazs >> Sent: Monday, June 09, 2003 11:53 AM >> To: dev...@li... >> Subject: Re: [Dev-C++] Cleaning the Input Buffer >> >> My Question: >> Why do you want new C++ commands? That'll only make things more >> complicated, they are slower, and will make your program bloated. >> The "old" C version is just fine. IV> In the contrary they are simpler, they should not be slower and make the IV> program with less lines and more bullet-proof. Yes, for sure... And also some problems could happen when mixing stdio and iostream code because of separated buffering, for example: printf (" Something") cout << " strange"; printf (" happened"); <= here stdout is flushed cout << " with the string"; could produce: Something happened strange with the string I don't know if it is regulated by C++ standard, but some compilers make code with "special effects" described above... -- Pozdrowienia, Krzysztof mailto:sa...@op... http://www.saveman.w.pl |
From: Ioannis V. <iv...@em...> - 2003-06-09 10:48:54
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of OROSZI Balazs > Sent: Monday, June 09, 2003 11:53 AM > To: dev...@li... > Subject: Re: [Dev-C++] Cleaning the Input Buffer > > My Question: > Why do you want new C++ commands? That'll only make things more > complicated, they are slower, and will make your program bloated. > The "old" C version is just fine. In the contrary they are simpler, they should not be slower and make the program with less lines and more bullet-proof. 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: Ioannis V. <iv...@em...> - 2003-06-09 10:30:24
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Andr? Macario Barros > Sent: Monday, June 09, 2003 4:11 AM > To: Dev-Cpp-Users > Subject: [Dev-C++] Basic Case in recursivity >=20 >=20 > Dear Users, > Please consider the followin code: >=20 > #include <iostream> > using std::cout; > using std::endl; > #include <cstdlib> >=20 > void someFunction(int [], int); >=20 > int main() > { > const int arraySize =3D 10; > int a[arraySize] =3D {32, 27, 64, 18, 95, 14, 90, 70, 60, 37}; >=20 > cout << "Array values are:" << endl; > someFunction(a, arraySize); // the array is printed in=20 > reversal order > cout << endl; >=20 > system("PAUSE"); > return 0; > } >=20 > 1-void someFunction(int b[], int size) > 2-{ > 3- if(size > 0) > 4- { > 5- someFunction(&b[1], size-1); > 6- cout << b[0] << " "; > 7- } > 8-} >=20 > A) I allways worked with recursive functions that had an explict > Basic Case, i.e., an "if" statement, and a return command; > B) Here in this recursive function there isn=B4t a if/return command > as you can see. I think when the calls arrive in the > "someFunction(&b[9], size-9);", the cout in line 6 is executed; >=20 > My Questions: > 1) Is there any implicit basic case for recursive functions without an > explicit if/return command? What do you mean. A recursive function is one that calls itself recursivelly, no matter if it returns a value or has a if statement (although it must have a termination check condition unavoidably).=20 > 2) How is the dynamic of this function? All the calls to=20 > someFunction are > made and only after this the command of line 6 is made? In=20 > the last call > for the 10th element? Yes. And ithen t prints the "b[0]" which is the last element towards the first (the b[0] of last call is executed, then from the one before the = last and so on). The dynamic is stupid. It can be implemented using a loop (=3Dmore = run-time efficiently and less stack memory consuming). 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: Krzysztof K. <sa...@op...> - 2003-06-09 09:07:46
|
Hello, You wrote: OB> André Macário Barros wrote: >> Dear Users, >> >> What I put in X for this loop escape when I type the Esc key? >> >> char key_kbd; >> >> do >> { >> cout << " loop still running " << endl; >> }while(key_kbd = cin.get()!= X); >> >> -->C++ code! OB> Write a small prog, that writes out the value of each key pressed, OB> that'll give you the code of ESC. I don't know it. Escape key code is 27 And this is for future: (i don't know if it works correctly under Dev-Cpp, but it should be easy to modify it...) Value 0-XXX means that it is an extended code (first char 0, next byte is key code). For example keys F1-F10 have codes from 0-59 to 0-68. ---- CUT ---- #include <conio.h> int main () { int k; for (;;) { k = getch (); if (k == 27) break; gotoxy (1,2); if (k) cprintf (" %d ", k); else cprintf("0-%d ",getch()); } return 0; } ---- CUT ---- -- Best regards, Krzysztof mailto:sa...@op... http://www.saveman.w.pl |
From: <or...@vp...> - 2003-06-09 08:56:12
|
André Macário Barros wrote: > Dear Users, > > What I put in X for this loop escape when I type the Esc key? > > char key_kbd; > > do > { > cout << " loop still running " << endl; > }while(key_kbd = cin.get()!= X); > > -->C++ code! Write a small prog, that writes out the value of each key pressed, that'll give you the code of ESC. I don't know it. -- Greetings, Balázs |
From: <or...@vp...> - 2003-06-09 08:52:53
|
André Macário Barros wrote: > My Question: > 1) How to clean stdin using new C++ commands? My Question: Why do you want new C++ commands? That'll only make things more complicated, they are slower, and will make your program bloated. The "old" C version is just fine. -- Greetings, Balázs |
From: Yeoh H. <ye...@ye...> - 2003-06-09 05:42:01
|
----- Original Message ----- From: "Psymaster ???????" <ro...@ho...> To: <dev...@li...> Sent: Sunday, June 08, 2003 10:49 PM Subject: [Dev-C++] Help running SDL under dev-c++ > Could you please help me? I have tried dev-c++ packages and it always gives > an error about "winmain@16" or "SDL_init" something. I think I'm doing > everything right, I've added the compiler command-line options, and sdl.dll > in /system32 but no go. > Hi, You get the error because SDL defines its own program entry point, so you can't use WinMain. In the Project Option, Parameters, C Compiler, you should enter this define: -Dmain=SDL_main In the Project Option, Parameters, Linker, you should enter something like this: -lmingw32 -lSDLmain -lSDL -mwindows -s My include directory and lib directory are: D:\SDL125\i386-mingw32msvc\include\SDL D:\SDL125\i386-mingw32msvc\lib I have compiled and linked two test examples: testwin and testalpha from the SDL 1.2.5 distribution. The two projects are built using Dev-C++ 4.9.8.0 (GCC 3.2). If you like, I could zip the project files and e-mail them to you. Best Regards, Yeoh ~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~ ICT eBooks by Yeoh HS Free Downloads at http://www.yeohhs.com ~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~`~ |
From: Per W. <pw...@ia...> - 2003-06-09 04:52:12
|
A variation on the theme is to build the list as a ring. Then you get: getfirst() { return last ? last->next : NULL; } getlast() { return last; } getnext(ptr) { return ptr == last ? NULL : ptr->next; } Quick insert both at head and tail, but list only needs one pointter. /Per W On Mon, 9 Jun 2003, Ioannis Vranos wrote: > Ok, got it. > > > > > > Ioannis Vranos > > * Programming pages: http://www.noicys.freeurl.com > * Alternative URL 1: http://run.to/noicys > * Alternative URL 2: http://www.noicys.cjb.net > > > > > -----Original Message----- > > From: Per Westermark [mailto:pw...@ia...] > > Sent: Sunday, June 08, 2003 6:39 PM > > To: Ioannis Vranos > > Cc: Dev-C++ Mailing List > > Subject: RE: [Dev-C++] Single Linked List-IV > > > > > > If the list is non-empty, then *last is non-NULL. In that > > case, the OLD > > last entry should have it's next pointer pointing at the NEW > > last entry. > > > > It doesn't matter if the list was empty or not. After an insert - the > > insert is always at the end of the list - *last should be set > > to point to > > the NEW last entry. Without this last line, LAST would always > > be NULL, and > > you wouldn't get a linked list. > > > > > ------------------------------------------------------- > 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: Ioannis V. <iv...@em...> - 2003-06-09 03:09:41
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Luigi Santillo > Sent: Sunday, June 08, 2003 9:15 AM > To: 'Dev-Cpp-Users' > Subject: Re: [Dev-C++] Single Linked List-IV > > > 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 > > 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. And why use such tricks in the first place and not single pointers? 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: Ioannis V. <iv...@em...> - 2003-06-09 03:06:56
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Socha, David F > Sent: Sunday, June 08, 2003 5:26 PM > To: Dev C++ Mailing List > Subject: [Dev-C++] Copy Constructor for a BST Class >=20 >=20 > I am using the most current version of DEV C++ > =20 > This is the code I am currently using for copy constructor on=20 > my Binary Search Tree code. I don't believe this should=20 > cause any problems but if anyone can give me help on this I=20 > would greatly appricate it. Keep in mind that the copy Tree=20 > function works on a recursive basis >=20 > =20 >=20 > template <typename T> BST<T>::BST(const BST& origTree){ =20 > //copy constructor >=20 > if(origTree.root){ >=20 > copyTree(origTree.root, root); >=20 > } >=20 > } >=20 > =20 >=20 > =20 >=20 > /************************************************************* > *************** >=20 > copyTree function >=20 > Used by the copy constructor to copy the tree >=20 > Sent: pointer to the original node, pointer to the node being=20 > copied to >=20 > Returns: Nothing >=20 > Works by: Creating a new node on the tree being copied, copy=20 > the data to the >=20 > node, checks to see if a left node exists on the tree, if yes >=20 > repeat the process using on the left node, if not, do=20 > nothing. Then checks >=20 > the right, if it exists repeat process on the right side, if=20 > not, do nothing >=20 > NOTE: This function is a recursive process >=20 > ************************************************************** > **************/ >=20 > =20 >=20 > template<typename T> void BST<T>::copyTree(Node* origNode,=20 > Node* copyNode){ >=20 > copyNode =3D new Node(origNode->data); >=20 > =20 >=20 > if(origNode->left){ >=20 > copyTree(origNode->left, copyNode->left); >=20 > } >=20 > =20 >=20 > if(origNode->right){ >=20 > copyTree(origNode->right, copyNode->right); >=20 > } >=20 > } >=20 > //End copyTree The code looks safe with the serious exception that you do not handle = memory allocation failure (an std::bad_alloc exception). 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: Ioannis V. <iv...@em...> - 2003-06-09 03:03:29
|
Ok, got it. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net > -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Sunday, June 08, 2003 6:39 PM > To: Ioannis Vranos > Cc: Dev-C++ Mailing List > Subject: RE: [Dev-C++] Single Linked List-IV > > > If the list is non-empty, then *last is non-NULL. In that > case, the OLD > last entry should have it's next pointer pointing at the NEW > last entry. > > It doesn't matter if the list was empty or not. After an insert - the > insert is always at the end of the list - *last should be set > to point to > the NEW last entry. Without this last line, LAST would always > be NULL, and > you wouldn't get a linked list. |
From: <and...@su...> - 2003-06-09 02:16:01
|
Dear Users, What I put in X for this loop escape when I type the Esc key? char key_kbd; do { cout << " loop still running " << endl; }while(key_kbd = cin.get()!= X); -->C++ code! Regards Andre |