dev-cpp-users Mailing List for Dev-C++ (Page 598)
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: Jason S. <mys...@op...> - 2002-04-19 08:21:37
|
It's an initalizer list. A short summary of them can be found here, http://pstonge.stmarys.medford.or.us/adv_cpp_1/lectures/advanced_functions2. htm, and here, http://oakroadsystems.com/codeprac/inher.htm. They're short, but to the point. Basically it's initalizing a data member to a value as it's created, instead of normal constructors which do so afterwards. Jason ----- Original Message ----- From: "Daniel Glenfield" <sp...@ho...> To: <dev...@li...> Sent: Friday, April 19, 2002 4:01 AM Subject: [Dev-C++] scope resolution +1 > What does it mean when you have the scope resolution operator and the single > : in the same bit of code? > > e.g. > > CDialog1::CDialog1(CWnd* pParent /*=NULL*/) > : CDialog(CDialog1::IDD, pParent) > > ? |
|
From: Daniel G. <sp...@ho...> - 2002-04-19 08:02:11
|
What does it mean when you have the scope resolution operator and the single : in the same bit of code? e.g. CDialog1::CDialog1(CWnd* pParent /*=NULL*/) : CDialog(CDialog1::IDD, pParent) ? _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |
|
From: Jason H. <jas...@bt...> - 2002-04-19 00:13:10
|
While I agree that you should avoid global variables, like Santiago says, they can be needed at times. The error you are getting is because each time you include the header you are in fact redeclaring it. Headers are *only* for definitions, and no instantiation should occur in them. What you need to do is create the global variable in the cpp file instead and in the header for that file put an extern statement, i.e. In the cpp file: // global variable int my_global_int; In the .h file: // allow other cpp files access to global variable extern int my_global_int; Hope this helps, Jason. ----- Original Message ----- From: "Daniel Glenfield" <sp...@ho...> To: <dev...@li...> Sent: Thursday, April 18, 2002 5:13 PM Subject: [Dev-C++] Global variables (linking errors) Help me out here would you? I have three C++ source files, each with its own header file. I want to have a global variable that all three source files can use. But when I put the variable into one of the header files I get Linker Errors, telling me the variable has already been defined in the first of my source code files. I think it's to do with the header files, but I'm not sure. Can anyone help? Daniel _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Blagger <car...@sk...> - 2002-04-18 18:05:52
|
Hi
As a beginner I came to the chapter "function overloading" of a C++ handbook
and had the following exercise.
The problem with this listing is that dev-C++ gives me the errors :
110 too many arguments to function double f-seize(double,double)
320 at this point in line.
I know this, that's why it's called function overloading, or am I completely
wrong ?
Thanks in advance for any help.
10 // computing clothes size
20 // excercise on functions with function overloading
30
40 #include <stdio.h>
50 #include <iostream.h>
60 #include <conio.h>
70 #include <math.h>
80
90 double hat_seize(double h_weight,double h_height);
100 // first function returns hat-seize
110 double f_seize(double j_weight,double j_years);
120 // second function returns Waist in inches
130 // when overloaded and returns also Jacket seize
140
150 int main(int argc, char *argv[])
160 {
170 cout.setf(ios::fixed);
180 cout.setf(ios::showpoint);
190 cout.precision(1);
200 char answer = 'y';
210 double height, weight, age, h_seize,j_seize,w_seize;
220
230 do
240 {
250 cout << "\nTyp hier uw lengte in (in cm) : "; cin >> height;
260 cout << "\nTyp hier uw gewicht in (in kg) : "; cin >> weight;
270 cout << "\nTyp hier uw leeftijd in (jaren) : "; cin >> age;
280 cout << "\nEffe wachtte" << endl;
290 h_seize = hat_seize(weight,height);
300 w_seize = f_seize(weight,age);
310 // now we overload the second function :
320 j_seize = f_seize(weight,height,age);
330 cout << "\n De grootte van uw hoed : "; cin >> h_seize;
340 cout << "\n De grootte van uw jas : "; cin >> j_seize;
350 cout << "\n De grootte van uw broek : "; cin >> w_seize; cout <<
endl;
360 cout << "\n\tNogmaals? (Y/N) : "; cin >> answer;
370
380 }
390 while ((answer == 'Y') || (answer == 'y'));
400
410 getch();
420
430 return 0;
440 }
450
460 // first function calculates hat-size
470 double hat_seize(double h_weight,double h_height)
480 {
490 return ((h_weight / h_height) * 2.9);
500 }
510
520 //Second function (normal)
530 double f_seize(double j_weight,double j_years)
540 {
550 return ((j_weight/5.7) + (floor((j_years - 28)/2)/10));
560 }
570 //Second function (overloaded)
580 double f_seize(double j_weight,double j_height, double j_years)
590 {
600 return (((j_weight * j_height)/288) + (floor((j_years - 30)/10)/8));
610 }
|
|
From: Santiago P. C. <San...@yd...> - 2002-04-18 17:36:39
|
Hi Daniel, Avoid the use of global variables!!! Define the variable in the "main file" and pass it through pointers/references to functions located in other code files. It will be better if you do the same in the "main file", let's say: define the variable inside the main function and pass it to functions as a pointer/reference, you'll never worry again about where the child function code is: in the same file or in another file. Again: avoid the use of global variables!!! Hope this helps! Regards, Santy PS: If I remember well there is something you can do with 'extern' reserved word, but this is something I do not use, maybe someone else can give you more help... Sorry -----Original Message----- From: Daniel Glenfield [mailto:sp...@ho...] Sent: Thursday, April 18, 2002 6:13 PM To: dev...@li... Subject: [Dev-C++] Global variables (linking errors) Help me out here would you? I have three C++ source files, each with its own header file. I want to have a global variable that all three source files can use. But when I put the variable into one of the header files I get Linker Errors, telling me the variable has already been defined in the first of my source code files. I think it's to do with the header files, but I'm not sure. Can anyone help? Daniel _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users -------------------------------------------------------------------------------------- This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. No confidentiality or privilege is waived or lost by any wrong transmission. If you have received this message in error, please immediately destroy it and kindly notify the sender by reply email. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Opinions, conclusions and other information in this message that do not relate to the official business of Ydilo Advanced Voice Solutions, S.A. shall be understood as neither given nor endorsed by it. -------------------------------------------------------------------------------------- |
|
From: Daniel G. <sp...@ho...> - 2002-04-18 16:14:06
|
Help me out here would you? I have three C++ source files, each with its own header file. I want to have a global variable that all three source files can use. But when I put the variable into one of the header files I get Linker Errors, telling me the variable has already been defined in the first of my source code files. I think it's to do with the header files, but I'm not sure. Can anyone help? Daniel _________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com |
|
From: Bob W. <bo...@ph...> - 2002-04-18 13:06:45
|
MessageI've been think about this, and isn't the call to =
system("pause"); a windows specific call and as such would not be =
portable to UNIX or any other operating system?
Regards,
Bob
A more ANSI C++ compliant code would be:
#include <iostream>
#include <cstdlib>
int main ()
{
using std::cout;
using std::endl;
using std::system;
=20
enum {Dog,Cat,Horse,Pig};
int i;
=20
for (i =3D Dog; i <=3D Pig; i++)
cout << "i =3D " << i << endl;
=20
=20
system("pause");
=20
return 0;
}
=20
or check the comments i have placed in your code.
Ioannis
|
|
From: <lho...@ho...> - 2002-04-18 13:03:28
|
I think that is ANSI compatible but the BCB does not support.
try this:
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc,char **argv){
const int i=10;
//use a const here.
int arr[i];
system("pause");
return 0;
}
I havn't BCB,but I test it with CL.exe.
>From: "Anon" <an...@pu...>
>To: <dev...@li...>
>Subject: [Dev-C++] Ansi compatible?
>Date: Thu, 18 Apr 2002 11:50:11 +0530
>
>Hey!
>Can anyone please tell me if the following code is ANSI compatible? It
compiles fine with DevC++ but throws up an error in Borland 5.0
>
>#include <iostream.h>
>#include <stdlib.h>
>
>int main()
>{
> int i=10;
> int arr[i]; //can it do accept Integer variable
> system("PAUSE");
> return 0;
>}
>
>My classmates say that this is a violation of ANSI standard.
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.346 / Virus Database: 194 - Release Date: 4/10/2002
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:
http://messenger.microsoft.com/cn
|
|
From: <lho...@ho...> - 2002-04-18 13:02:42
|
I think that is ANSI compatible but the BCB does not support.
try this:
#include <iostream>
#include <cstdlib>
using namespace std;
int main(int argc,char **argv){
const int i=10;
//use a const here.
int arr[i];
system("pause");
return 0;
}
I havn't BCB,but I hava tested it with CL.exe.
>From: "Anon" <an...@pu...>
>To: <dev...@li...>
>Subject: [Dev-C++] Ansi compatible?
>Date: Thu, 18 Apr 2002 11:50:11 +0530
>
>Hey!
>Can anyone please tell me if the following code is ANSI compatible? It
compiles fine with DevC++ but throws up an error in Borland 5.0
>
>#include <iostream.h>
>#include <stdlib.h>
>
>int main()
>{
> int i=10;
> int arr[i]; //can it do accept Integer variable
> system("PAUSE");
> return 0;
>}
>
>My classmates say that this is a violation of ANSI standard.
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.346 / Virus Database: 194 - Release Date: 4/10/2002
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:
http://messenger.microsoft.com/cn
|
|
From: Ioannis V. <no...@ho...> - 2002-04-18 11:06:27
|
-----Original Message-----
From: Ioannis Vranos [mailto:no...@ho...]
Sent: Thursday, April 18, 2002 1:49 PM
To: Dev-C++
Subject: RE: [Dev-C++] Ansi compatible?
#include <stdlib.h>
[...]
std::system("PAUSE");
std:: was not needed since you use the xxx.h notion for the C subset
header files. It would be needed if it was
#include <cstdlib>
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
<http://www.noicys.cjb.net/>
* Alternative URL: http://run.to/noicys
|
|
From: <jar...@ig...> - 2002-04-18 10:56:44
|
>>From: "Anon" <an...@pu...>
>>To: <dev...@li...>
>>Subject: [Dev-C++] Ansi compatible?
>>Date: Thu, 18 Apr 2002 11:50:11 +0530
>>
>>Hey!
>>Can anyone please tell me if the following code is ANSI compatible? It
>>compiles fine with DevC++ but throws up an error in Borland 5.0
>>
>>#include <iostream.h>
this should be #include <iostream> but you don;t need it in this
program
>>#include <stdlib.h>
this should be
#include <cstdlib>
using std::system; // since you need the system function from cstdlib
>>
>>int main()
>>{
>> int i=10;
>> int arr[i]; //can it do accept Integer variable
NO, according to the standard this is only possible if you
replace the line above by
const int i=10;
>> system("PAUSE");
>> return 0;
>>}
>>
>>My classmates say that this is a violation of ANSI standard.
They're right.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
Institute of Technology, RWTH Aachen
D 52056 Aachen, Germany
|
|
From: Ioannis V. <no...@ho...> - 2002-04-18 10:49:39
|
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Anon
Sent: Thursday, April 18, 2002 9:20 AM
To: dev...@li...
Subject: [Dev-C++] Ansi compatible?
Hey!
Can anyone please tell me if the following code is ANSI compatible? It
compiles fine with DevC++ but throws up an error in Borland 5.0
#include <iostream.h>
#include <iostream>
#include <stdlib.h>
int main()
{
int i=10;
const int i=10;
int arr[i]; //can it do accept Integer variable
std::system("PAUSE");
return 0;
}
My classmates say that this is a violation of ANSI standard.
It is.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
<http://www.noicys.cjb.net/>
* Alternative URL: http://run.to/noicys
|
|
From: chiesa <chi...@si...> - 2002-04-18 10:07:19
|
hi,
i want to add wxWindows package to dev-c++.
but i don't know how to add a package to dev-c++ so
that i can open a self-defined project.
i know little details of package and template using in dev-c++.
i search the web using google,
but find none.
can anyone give me some help.
thanks.
chiesa
chi...@si...
|
|
From: Daniel G. <sp...@ho...> - 2002-04-18 09:59:14
|
Ummm not sure, I don't think you need iostream. But if so, try
#include <iostream>
then inside main()
using namespace std;
>From: "Anon" <an...@pu...>
>To: <dev...@li...>
>Subject: [Dev-C++] Ansi compatible?
>Date: Thu, 18 Apr 2002 11:50:11 +0530
>
>Hey!
>Can anyone please tell me if the following code is ANSI compatible? It
>compiles fine with DevC++ but throws up an error in Borland 5.0
>
>#include <iostream.h>
>#include <stdlib.h>
>
>int main()
>{
> int i=10;
> int arr[i]; //can it do accept Integer variable
> system("PAUSE");
> return 0;
>}
>
>My classmates say that this is a violation of ANSI standard.
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.346 / Virus Database: 194 - Release Date: 4/10/2002
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
|
|
From: Anon <an...@pu...> - 2002-04-18 06:28:29
|
Hey!
Can anyone please tell me if the following code is ANSI compatible? It =
compiles fine with DevC++ but throws up an error in Borland 5.0
#include <iostream.h>
#include <stdlib.h>
int main()
{
int i=3D10;
int arr[i]; //can it do accept Integer variable
system("PAUSE");
return 0;
}
My classmates say that this is a violation of ANSI standard.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.346 / Virus Database: 194 - Release Date: 4/10/2002
|
|
From: Jason H. <jas...@bt...> - 2002-04-18 01:19:44
|
I agree, but in addition to that it can be useful for flags i.e.
enum state {calm =3D 0, upset =3D 1, crying =3D 2, nervous =3D 4, =
psychotic =3D 8};
So you could say I am feeling:
state myself =3D psychotic | crying;
Which should evaluate to (int) 10.
Jason.
PS: probably not the best example in the world, but humour me.
----- Original Message -----=20
From: Bob Wilson=20
To: Dev-C++ User Mailing List=20
Sent: Wednesday, April 17, 2002 7:29 PM
Subject: Fw: [Dev-C++] enum
The default is 0, and then each consequtive one is +1 the previous =
one. You can change the value of an enum by initialising it to something =
else, i.e.
enum farmyard {cow, sheep, pig, chicken, fruitbat =3D 1000, =
elephant, pigmi}
so cow =3D 0, sheep =3D 2, etc.. and then fruitbat =3D 1000, =
elephant =3D 1001, and so on.
Absolutely correct, but when you assign a value to an enumerated =
element, it practically destroys or greatly limits the ability to use =
the enumerated elements in a for loop or switch statement.=20
Regards,
Bob Wilson
|
|
From: Bob W. <bo...@ph...> - 2002-04-17 18:27:52
|
The default is 0, and then each consequtive one is +1 the previous =
one. You can change the value of an enum by initialising it to something =
else, i.e.
enum farmyard {cow, sheep, pig, chicken, fruitbat =3D 1000, elephant, =
pigmi}
so cow =3D 0, sheep =3D 2, etc.. and then fruitbat =3D 1000, elephant =
=3D 1001, and so on.
Absolutely correct, but when you assign a value to an enumerated =
element, it practically destroys or greatly limits the ability to use =
the enumerated elements in a for loop or switch statement.=20
Regards,
Bob Wilson
|
|
From: Ioannis V. <no...@ho...> - 2002-04-17 18:14:17
|
A more ANSI C++ compliant code would be:
#include <iostream>
#include <cstdlib>
int main ()
{
using std::cout;
using std::endl;
using std::system;
enum {Dog,Cat,Horse,Pig};
int i;
for (i = Dog; i <= Pig; i++)
cout << "i = " << i << endl;
system("pause");
return 0;
}
or check the comments i have placed in your code.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
<http://www.noicys.cjb.net/>
* Alternative URL: http://run.to/noicys
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Bob
Wilson
Sent: Wednesday, April 17, 2002 3:03 PM
To: Dev-C++ User Mailing List
Subject: Re: [Dev-C++] enum
Daniel;
when you enumerate variables, is the first one (by default) 0 or 1 ?
Run this little program and you will get your answer.
#include <iostream.h>
#include <iostream>
#include <conio_mingw.h>
Not portable.
#include <stdio.h>
Not needed.
// #include <windows.h>
Header file for system extensions. Non needed.
// #include <stdlib.h>
// #include <time.h>
Not needed.
enum {Dog,Cat,Horse,Pig};
int main (int argc, char *argv[])
{
int i;
for (i = Dog; i <= Pig; i++)
std::cout << "i = " << i << std::endl;
std::cout << "\n\nHit any key to close window . . .";
while (!kbhit());
Not needed system extension.
return 0;
}
|
|
From: Ioannis V. <no...@ho...> - 2002-04-17 17:52:36
|
0 Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Daniel Glenfield > Sent: Wednesday, April 17, 2002 1:04 PM > To: dev...@li... > Subject: [Dev-C++] enum > > > when you enumerate variables, is the first one (by default) 0 or 1 ? > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Jason H. <jas...@bt...> - 2002-04-17 14:27:55
|
The default is 0, and then each consequtive one is +1 the previous one. =
You can change the value of an enum by initialising it to something =
else, i.e.
enum farmyard {cow, sheep, pig, chicken, fruitbat =3D 1000, elephant, =
pigmi}
so cow =3D 0, sheep =3D 2, etc.. and then fruitbat =3D 1000, elephant =
=3D 1001, and so on.
Jason.
----- Original Message -----=20
From: Bob Wilson=20
To: Dev-C++ User Mailing List=20
Sent: Wednesday, April 17, 2002 1:02 PM
Subject: Re: [Dev-C++] enum
Daniel;
when you enumerate variables, is the first one (by default) 0 or 1 ?
Run this little program and you will get your answer.
#include <iostream.h>
#include <conio_mingw.h>
#include <stdio.h>
// #include <windows.h>
// #include <stdlib.h>
// #include <time.h>
enum {Dog,Cat,Horse,Pig};
int main (int argc, char *argv[])
{
int i;
for (i =3D Dog; i <=3D Pig; i++)
std::cout << "i =3D " << i << std::endl;
std::cout << "\n\nHit any key to close window . . .";
while (!kbhit());
return 0;
}
|
|
From: Bob W. <bo...@ph...> - 2002-04-17 12:01:21
|
Daniel;
when you enumerate variables, is the first one (by default) 0 or 1 ?
Run this little program and you will get your answer.
#include <iostream.h>
#include <conio_mingw.h>
#include <stdio.h>
// #include <windows.h>
// #include <stdlib.h>
// #include <time.h>
enum {Dog,Cat,Horse,Pig};
int main (int argc, char *argv[])
{
int i;
for (i =3D Dog; i <=3D Pig; i++)
std::cout << "i =3D " << i << std::endl;
std::cout << "\n\nHit any key to close window . . .";
while (!kbhit());
return 0;
}
|
|
From: aussie <aus...@bi...> - 2002-04-17 11:19:20
|
Tried to use the new DEVA to compile received a message. Access violation at address 004FB939 in model 'DEVCPP.EXE'.=20 Read of address FFFFFFFF |
|
From: Daniel G. <sp...@ho...> - 2002-04-17 10:04:29
|
when you enumerate variables, is the first one (by default) 0 or 1 ? _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
|
From: Ioannis V. <no...@ho...> - 2002-04-17 03:43:17
|
This is probably a linking error, so better post the code that produces the problem. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jcm...@ao... Sent: Wednesday, April 17, 2002 6:14 AM To: dev...@li... Subject: [Dev-C++] Compile-C++4 Hi, when I try to compile, I get the window: Compiler and linker output. What can I do? |
|
From: <Jcm...@ao...> - 2002-04-17 03:14:00
|
Hi, when I try to compile, I get the window: Compiler and linker output. What can I do? |