dev-cpp-users Mailing List for Dev-C++ (Page 622)
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: Lorenzo <co...@in...> - 2002-02-13 15:54:53
|
I didn't understand your question. If you want to display the bitmap that
you have included in exe this is the code:
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
hdcMem = CreateCompatibleDC(hdc);
SelectObject(hdcMem, hBitmap);
SetMapMode(hdcMem, GetMapMode(hdc));
GetObject(hBitmap, sizeof(BITMAP), (LPVOID)&bm);
ptSize.x = bm.bmWidth;
ptSize.y = bm.bmHeight;
DPtoLP(hdc, &ptSize, 1);
ptOrg.x = 0;
ptOrg.y = 0;
DPtoLP(hdcMem, &ptOrg, 1);
BitBlt(hdc, 0, 0, ptSize.x, ptSize.y, hdcMem, ptOrg.x, ptOrg.y,
SRCCOPY);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
break;
I attach the full code. If your problem is other explain it again, i don't
understand.
----------------------------------------------------------------------------
---
If debugging is the process of removing bugs,
then programming must be the process of putting them in.
----------------------------------------------------------------------------
---
|
|
From: Mark S. <mar...@li...> - 2002-02-13 15:40:41
|
Does anyone know of any public domain iterative matrix inversion C code for large dense non-symmetric matrices? (not too much to ask surely) I have been using the numerical recipes in C routine for Gauss-Jordan elimination on matrices bigger than 5000x5000 and you might be pleased to know that the C/C++ Mingw compiler produces the fastest code out of a head to head with the Borland bcc5.5 command line compiler or the excellent LCC win 32 compiler all with maximum speed optimisation turned on. Regards Mark -------------------------------------------------------------------------- This e-mail may contain privileged/confidential information and may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender by return e-mail or by telephoning +44 (0)1480 302100. Please then delete the e-mail and do not disclose its contents to any person. Any information in this message that does not relate to the official business of Linx shall be understood as neither given nor endorsed by Linx. We reserve the right to monitor all e-mail communications through our internal and external networks. -------------------------------------------------------------------------- |
|
From: David G. <dav...@ho...> - 2002-02-13 14:15:43
|
>>EOF _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
|
From: Grigory K. <Gri...@il...> - 2002-02-13 13:40:41
|
GK |
|
From: Claus <cl...@vi...> - 2002-02-13 13:33:14
|
/Claus |
|
From: Tina M. <tin...@vi...> - 2002-02-13 13:32:28
|
/Claus |
|
From: Hans V. <vis...@ho...> - 2002-02-13 13:25:38
|
Thanks, Hans Visser |
|
From: zeta <ze...@ze...> - 2002-02-13 12:21:56
|
Thank You, A. Erdogan Horzum |
|
From: Joost v. R. <jo...@va...> - 2002-02-13 07:29:50
|
I am trying to use a bitmap image in my executable. So far I managed to load it in to the rsrc.o file by using the following line in my resource file... image BITMAP "E:/image.bmp" It is getting linked to the executable, so that seems to work fine. But I can't seem to figure out how to use this file in the rest of my code. How do I call it? I would like the executable to write it to some place on the harddisk as soon as the exe file is running. I tried to read the tutorial on http://www.foosyerdoos.fsnet.co.uk/ but that did not help me much... Joost |
|
From: Ioannis V. <no...@ya...> - 2002-02-13 05:16:00
|
> -----Original Message----- > From: Ioannis Vranos [mailto:no...@ya...] > Sent: Wednesday, February 13, 2002 4:52 AM > To: Dev-C++ (dev...@li...) > Subject: RE: [Dev-C++] Database program (how do i do that?) > > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Benjamin Levinn > > Sent: Wednesday, February 13, 2002 2:30 AM > > To: Dev-C++ > > Subject: RE: [Dev-C++] Database program (how do i do that?) > > > > > > Actually, text is, if anything, less portable than binary. Even > > between Windows NT and 98 there is a difference in text: NT uses > > unicode, while 98 uses an 8-bit character. Binary, however, > is just a > > collection of bits in no particular format at all, so it can > > be ported to > > any machine at all, and read, as long as the program reading it > > knows how it is formatted. > > > Well the same file is created by the same exe in any windows > version. Also for ascii text files, there is no way something > non-ascii compatible is used. If this happened, then our text > files would not be readable by different machines, e.g. my > html files that i create to my machine and then place them on the web. Also when we write in text mode non-characters, we see garbage. Anyway in a few words, text files *are* portable and can be shared among applications (from this concept XML was thought, text is read by anything). Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ya...> - 2002-02-13 02:52:13
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Benjamin Levinn > Sent: Wednesday, February 13, 2002 2:30 AM > To: Dev-C++ > Subject: RE: [Dev-C++] Database program (how do i do that?) > > > Actually, text is, if anything, less portable than binary. Even > between Windows NT and 98 there is a difference in text: NT uses > unicode, while 98 uses an 8-bit character. Binary, however, is just a > collection of bits in no particular format at all, so it can > be ported to > any machine at all, and read, as long as the program reading it > knows how it is formatted. Well the same file is created by the same exe in any windows version. Also for ascii text files, there is no way something non-ascii compatible is used. If this happened, then our text files would not be readable by different machines, e.g. my html files that i create to my machine and then place them on the web. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys |
|
From: A. E. H. <ze...@ze...> - 2002-02-13 00:35:22
|
Your mail received. Thank You, A. Erdogan Horzum www.zetamuhendislik.com |
|
From: Benjamin L. <bl...@ta...> - 2002-02-13 00:29:49
|
Actually, text is, if anything, less portable than binary. Even between Windows NT and 98 there is a difference in text: NT uses unicode, while 98 uses an 8-bit character. Binary, however, is just a collection of bits in no particular format at all, so it can be ported to any machine at all, and read, as long as the program reading it knows how it is formatted. -BL On 10 Feb 2002 at 19:24, Ioannis Vranos wrote: > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Flavio de Souza > > Sent: Sunday, February 10, 2002 4:08 PM > > To: Dev-cpp > > Subject: [Dev-C++] Database program (how do i do that?) > > > > > > Hey Listers: > > > > I am trying to learn cpp and I am trying to do a simple > > application with a database ( just to hold some notes, > > comments, etc ). > > > > I have seen around some .dat files, and they seem to be a txt > > file. I know that cpp can create binary file as well. > > > > Actually, I do not know how to start, then I got a few questions: > > > > 1) Which one is better txt or binary? (In my application all > > the data is just text ) > > > If you want portability, only text is portable.That is it can be read in > all platforms. The catch is that text occupies more space. > > > > 2) How do I create a database with txt files or binary files? > > > In C or C++? > > > > Any suggestions or a good tutorial in the web? > > 3) Once it was created, how do I perform a search in > > database? Do I need an index table? (I don't even know how to do this) > > > You will think a way. It depends on various factors, what searches you > will do, if you keep your records sorted ans by which criteria e.t.c.. > > > > > > > > I got other questions, but I think I'll start with the basic ones. > > > > I'd appreciate some help with this. I have been studying cpp > > and I have passed through all those boring tutorials about > > language basics. Now I want to do a real > > application, simple, but real ! > > > I also suggest "The C++ Programming Language" 3rd Edition or Special > Edition by Bjarne Stroustrup the creator of C++. > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.d2g.com > * Alternative URL: http://run.to/noicys > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Ioannis V. <no...@ya...> - 2002-02-13 00:15:24
|
Everytime you send an email to the list that acccount sends you an email that it has received your email. If the list was in the old way that when we press reply, the email was sended automatically to the list, then we would have zillions of emails since it would receive its own email and respond in a loop (with the amount increased at every new email we would send in the list). Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.d2g.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of gi...@li... > Sent: Tuesday, February 12, 2002 7:48 PM > To: dev...@so... > Subject: Re: [Dev-C++] Auto Respond > > > Hello list, > > Sorry to bother you with off topic silly questions, but in > the last weeks I > keep receiving the message quoted below, almost every time I > download mail > from the list. I was wondering if it is related to my system or is it > something happening to somebody else too. > > At 15:12 11/02/02 -0500, A. Erdogan Horzum wrote: > >Your mail received. > > > >Thank You, > > > >A. Erdogan Horzum > >www.zetamuhendislik.com > > > -- > gisan > gi...@li... > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Ioannis V. <no...@ya...> - 2002-02-13 00:12:39
|
No it has to do that it reads the number and stores it in the variable aand the '\n' remains in the stream. This is not a bad thing but a good one because no information is lost and you have 100% low level control of the stream. Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of patche Sent: Tuesday, February 12, 2002 6:48 PM To: dev...@li... Subject: [Dev-C++] RE: Dev C++ Question Vol. 1 #612 - cin.get() Nitpicking aside I think the reason why it does that has something to do with the compiler reading a newline command into either [ENTER] key or "\n" and replacing them with "\0" the null symbol. Anyone, care to comment? patche |
|
From: Ioannis V. <no...@ya...> - 2002-02-13 00:07:45
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Flavio de Souza
> Sent: Tuesday, February 12, 2002 11:20 PM
> To: dev...@li...
> Subject: [Dev-C++] Re: Dev-cpp-users digest, Vol 1 #610 - 10 msgs
>
>
> Thanks everybody for the valuable help!
>
> Thanks Devin, Ioannis, Bob, etc
>
> Ioannis, to answer your question:
>
> I will use C++ ( I am trying as much as possible to program in C++)
>
> Basically the type of search I will use is the following:
>
> Let's say I have many "NOTES" with several lines.
>
> _______My Notes Database_____________
> NOTE 1
> alsjdf aldlfa lasjf
> lakjslf
> aljsdflas
> NOTE 2
> alsjdf aldlfa lasjf
> lakjslf
> aljsdflas
> NOTE 3
> alsjdf aldlfa lasjf
> lakjslf
> aljsdflas
> NOTE 4
> alsjdf aldlfa lasjf
> lakjslf
> aljsdflas
> ----------------------------------------------------------------
>
> I want to get to the Note by using some kind of ID or maybe
> get the an address position inside the file and go directly
> to the note (just an idea, I don't know how to do that)
>
> Any comments? Ideas?
Yes, you will create a binary file (or text if you want to share it
between various versions of your program, linux e.t.c.) and you will
place in it the records in ascending order acccording to their id. There
will be a boolean variable in every record indicating if the file was
deleted.
E.g.
class record
{
unsigned long ID;
bool deleted;
// ...
public:
record(unsigned long id): erased(false), ID(id) {}
bool is_erased() { return deleted; }
void erase() { deleted=true; }
// ...
};
Every time you erase a record e.g. a you will do
a.erase();
This is called logical deletion.
At the end of your program or after every logical erasion or how you
decide to do it, you will create a temporary file, you will copy the
contents of your primary file there, and then from there you will copy
back only the records whose .is_erased() is false. This is called
physical deletion. Also in some phase (probably in the temp file) you
will sort the non-erased records according to their ID (giving new ID
numbers to make them continuous, e.g. when you have the non erased
remaining records with IDs 1, 3,4 e.t.c. you will do them 1,2,3. You
will probably do this before the copy back (before the physical
deletion) in the style:
int i=0;
go_to_begin_of_file
read record to a record variable
if (!variable.is_erased())
variable.makeid(i++);
go back one record
write record
read next record...
And then copy back to the original file without the logically erased
records
It is easy if you think on it. :)
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.d2g.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2002-02-12 23:54:13
|
The problem doesn;t lie in the language itself, it lies on its use by us. :) Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of patche Sent: Tuesday, February 12, 2002 4:43 PM To: dev...@li... Subject: [Dev-C++] cin.get() I am new to programming and have a huge story on all of the compiler/IDEs that I've tried until I found DevCPP kudos to everyone involved. There was a question that was asked about gett cin.get() to work. I don't know why but I had the same problem and the book with which I am teaching myself or some other tutorial I was reading can't recall, suggested that I use cin.get() twice, like so: //template.cpp - Template for CPP #include <iostream> using namespace std; int main() { cin.get(); cin.get(); return 0; } So far, I haven't found any conflicts. With what I know I will suggest that the problem lies in the language itself. I was studying the section concerning strings and began to notice that the compiler actually hides alot of useful stuff that would be good to know. For instance, the compiler will take a carriage return [ENTER] for a "\n" character and then the newline character will be replaced with a null value "\0" of course the "\0" represents yet another number. I don't know if the explanation helps but I am sure putting it in twice will. Thanks Patche |
|
From: <gi...@li...> - 2002-02-12 22:52:11
|
Hello list, Sorry to bother you with off topic silly questions, but in the last weeks I keep receiving the message quoted below, almost every time I download mail from the list. I was wondering if it is related to my system or is it something happening to somebody else too. At 15:12 11/02/02 -0500, A. Erdogan Horzum wrote: >Your mail received. > >Thank You, > >A. Erdogan Horzum >www.zetamuhendislik.com -- gisan gi...@li... |
|
From: mike s. <fre...@ho...> - 2002-02-12 22:50:38
|
I dont know. After seeing it so many times, this might just not feel quite like the same old mailing list any more. Just joking. That is damn annoying. >From: Jason Silverman <mys...@op...> >Reply-To: Jason Silverman <mys...@op...> >To: "A. Erdogan Horzum" <ze...@ze...>, >dev...@li... >Subject: Re: [Dev-C++] Auto Respond >Date: Tue, 12 Feb 2002 15:26:58 -0500 > >Can someone either get this guy to turn the thing off (sent an email >asking, no response...) or something of the such? > >I mean sure it's only an email among the million other mailing list ones, >but seeing the same subject day after day after day.... >:) > > >Jay > ----- Original Message ----- > From: A. Erdogan Horzum > To: dev...@li... > Sent: Tuesday, February 12, 2002 3:10 PM > Subject: [Dev-C++] Auto Respond > > > Your mail received. > > Thank You, > > A. Erdogan Horzum > www.zetamuhendislik.com > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users Mike S. Codename: Freak901010 _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |
|
From: patche <pa...@ro...> - 2002-02-12 21:41:54
|
I myself am a brand new DevCPP fan and am, like you, new to programming=
CPP. I am not sure where I got this but my list of resources has grown=
exponentially since the first of the year.
To "pause" a program so that I can see that it works I was told to add one=
cin.get() and if that didn't work to add cin.get() twice, like this:
#include <iostream.h>
int main()
{
cout<<"The Compiler Works";
cin.get();
cin.get();
return 0;
}
By the way I corrected your example, you had left the ";" out. Nitpicking=
aside I think the reason why it does that has something to do with the=
compiler reading a newline command into either [ENTER] key or "\n" and=
replacing them with "\0" the null symbol. Anyone, care to comment?
patche
|
|
From: Bob C. <rc...@ps...> - 2002-02-12 21:14:59
|
This site has a short tutorial on Dev-C++ and some comments about cin.get()
<string> and system("Pause")...
http://www.geocities.com/uniqueness_template/
Bob
|
|
From: A. E. H. <ze...@ze...> - 2002-02-12 21:03:29
|
Your mail received. Thank You, A. Erdogan Horzum www.zetamuhendislik.com |
|
From: Jason H. <jas...@bt...> - 2002-02-12 20:55:49
|
Prime number examplesUm... I think you're off to a bad start then, cos =
there is a mistake in the code you have supplied. You don't want to =
declare a const array because you won't be able to modify it. As the =
array values will be only 1 or 0 (true or false) then I recoment using =
an array of bool.
The steps you need to take are described to you in the question, and I =
don't want to supply the program for you, after all it is an exercise =
for you. I'll try to clarify if tfor you.
Step (a) is the initialisation step which I will help you with:
#include <iostream>
using std::cout;
using std::endl;
void main()
{
const int MAX_PRIME =3D 1000; // a constant - change this value to =
increase or
// decrease the number of primes to calculate.=20
// By doing it this way you don't have to go through a program
// and change the same value several times if you want more =
primes.
// Create and initialise primes array (step a)
bool primes[MAX_PRIME];
primes[0] =3D false; // ignore array element 0
for(int index =3D 1; i < MAX_PRIME; ++i)
primes[index] =3D true; // true or 1: it's up to you
// Calculate primes using Sieve of Eratosthenes (b)
// you do this bit
=20
// Display prime numbers
// go for it!
}
Step (b):
What you need to do is find an index at which the value is true (1) =
starting from index 2. To find the value it's best to go through the =
array from the beginning point until you find it. This sugests a loop of =
some kind with a conditional (if) statement to detect the true value. =
You then need to go through the array from that point and set to false =
(0) every multiple of the true index you just found. Another loop.
This means that you actualy have a loop within a loop. You need to =
decide upon which looping construct you will use and make sure you =
figure out the proper exit conditions for the loops (clue: MAX_PRIME), =
an easy way of making multiples is to repeatedly add the value to a =
second index, rather than actualy performing multiplication.
The two loops should exit when all of the array has been gone through.
The trick is that the inner loop makes false values you can ignore in =
the outer loop.
One of the keys to understanding this approach is to understand that the =
prime numbers aren't actualy stored within in the array, the index of =
the array represents the prime number, the value at a particular index =
is telling you whether it's index is prime or not. In a way you are =
asking a question of the array. You say "Is the number 7 prime?" and you =
would look at the value at index 7 of the array (primes[7]) and it =
should answer with "True" or the value 1 which means true. I hope I'm =
not sounding silly now?
The third step is to display the prime values. All you need to do is run =
through the array like you did when initialising it, and print out all =
the index's who's corresponding values are true. i.e. IF value AT index =
IS true THEN PRINT index.
Hope this helps,
Jason.
P.S. I've not tested the code I've supplied so you may get syntax errors =
with it.
----- Original Message -----=20
From: Mitchell, Tamra (HNA)=20
To: 'dev...@li...'=20
Sent: Tuesday, February 12, 2002 6:00 PM
Subject: [Dev-C++] Prime number examples
Does any one have sample programs arrays and prime numbers?=20
I have a program Due Friday and am totally confused.=20
Can anyone point me in the right direction=20
Here is my exercise.=20
(The Sieve of Eratosthenes) A prime integer is any integer that is =
easily divisible only by itself and 1. The Sieve of Eratosthenes is a =
method of finding prime numbers. It operates as follows
a). Create an array with all elements initialized to 1 =
(true). Array elements with prime subscripts will remain 1. All other =
array elements will eventually be set to zero.
=20
b). Starting with array subscript 2 (subscripts 1 must be =
prime), every time an array element is found whose value is 1, loop =
through the remainder of the array and set to zero every element whose =
subscript is a multiple of the subscript for the element with value 1. =
For array subscript 2, all elements beyond 2 in the array that are =
multiples of 2 will be set to zero(subscripts 4, 6, 8, 10, etc.) for =
array subscript 3, all elements beyond 3 in the array that a are =
multiples of 3 will be set to zero (subscripts 6, 9, 12, 15 etc) and =
so on.
When this process is complete, the array elements that are still set =
to one indicate that the subscript is a prime number. These subscripts =
can then be printed. Write a program that uses an array of 1000 =
elements to determine and print the prime numbers between 1 and 999. =
Ignore element 0 of the array.
This is what I have so far=20
#include<iostream>=20
using std::cout;=20
using std::endl;=20
#include<iomanip>=20
int main()=20
{=20
const int i[1000];=20
}=20
Not much.=20
Tamra Y. Mitchell=20
Heinz North America=20
Database & Operating Systems Analyst=20
(412) 237-5232 Work=20
(412) 996-9078 Cell Phone=20
|
|
From: Flavio de S. <fla...@ne...> - 2002-02-12 20:30:20
|
I still got the same error.
Any ideas?
Fl=E1vio.
10/02/02 15:41:49, "Benjamin Wheeless" <ben...@ho...> wrote:
>
>
> From: "Benjamin Wheeless" <ben...@ho...>
> To: fla...@ne..., dev...@li...
>
> Subject:Re: [Dev-C++] ANSI C++ forbids implicit conversion from `void =
*' in
> argument passing
> Date: Sun, 10 Feb 2002 13:41:49 -0500
>
>
>
>
> Flavio,
>
> Have you tried replacing the "0" with a default flag such as:
> LR_DEFAULTCOLOR
>
>
> LR_DEFAULTCOLOR is just a default flag that really doesn't do anything
> except assure that your bitmap or image is loaded non-black and white.
>
> I hope that helps out.
>
>
> Benjamin Wheeless
> Network Systems - Delta Airlines, Inc.
> Atlanta, GA - USA 30320
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> >From: Flavio de Souza
> >To: Dev-cpp
> >Subject: [Dev-C++] ANSI C++ forbids implicit conversion from `void *'=
in
> argument passing=20
> >Date: Sun, 10 Feb 2002 15:41:07 -0300=20
> >=20
> >=20
> >I am trying to compile a windows program and I am getting the followi=
ng
> compiler error:=20
> >=20
> > ANSI C++ forbids implicit conversion from `void *' in argument passi=
ng=20
> >=20
> >This error occurs two times in the following piece of code where I ha=
ve the
> value "0" (see below).=20
> >=20
> >void WinClass::SetResIcons (int resId)=20
> >{=20
> > _class.hIcon =3D reinterpret_cast (=20
> > ::LoadImage (=20
> > _class.hInstance,=20
> > MAKEINTRESOURCE (resId),=20
> > IMAGE_ICON,=20
> > ::GetSystemMetrics (SM_CXICON),=20
> > ::GetSystemMetrics (SM_CYICON),=20
> > 0)); <--------------------------------------------------------------=
------
> ----------where i got the error=20
> > // Small icon can be loaded from the same resource=20
> > _class.hIconSm =3D reinterpret_cast (=20
> > ::LoadImage (=20
> > _class.hInstance,=20
> > MAKEINTRESOURCE (resId),=20
> > IMAGE_ICON,=20
> > ::GetSystemMetrics (SM_CXSMICON),=20
> > ::GetSystemMetrics (SM_CYSMICON),=20
> > 0)); <--------------------------------------------------------------=
------
> ----------where i got the error=20
> >=20
> >}=20
> >=20
> >Does anyone know a possible cause? What should I do to compile it
> correctly?=20
> >=20
> >Please, help me.=20
> >=20
> >=20
> >Flavio de Souza=20
> >fla...@ne...=20
> >ICQ:78458203=20
> >Sert=E3ozinho - SP - Brasil=20
> >=20
> >=20
> >=20
> >_______________________________________________=20
> >Dev-cpp-users mailing list=20
> >Dev...@li...=20
> >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20
>
>
>
> Send and receive Hotmail on your mobile device: Click Here
Flavio de Souza
fla...@ne...
ICQ:78458203
Sert=E3ozinho - SP - Brasil
|
|
From: Flavio de S. <fla...@ne...> - 2002-02-12 20:30:19
|
Thanks everybody for the valuable help! Thanks Devin, Ioannis, Bob, etc Ioannis, to answer your question: I will use C++ ( I am trying as much as possible to program in C++) Basically the type of search I will use is the following: Let's say I have many "NOTES" with several lines. _______My Notes Database_____________ NOTE 1 alsjdf aldlfa lasjf lakjslf aljsdflas NOTE 2 alsjdf aldlfa lasjf lakjslf aljsdflas NOTE 3 alsjdf aldlfa lasjf lakjslf aljsdflas NOTE 4 alsjdf aldlfa lasjf lakjslf aljsdflas ---------------------------------------------------------------- I want to get to the Note by using some kind of ID or maybe get the an ad= dress position inside the file and go directly to the note (just an idea,= I don't know how to do that) Any comments? Ideas? Thanks all again! Fl=E1vio. > >> 2) How do I create a database with txt files or binary files?=20 > > >In C or C++? > > >> Any suggestions or a good tutorial in the web? >> 3) Once it was created, how do I perform a search in=20 >> database? Do I need an index table? (I don't even know how to do this) > > >You will think a way. It depends on various factors, what searches you >will do, if you keep your records sorted ans by which criteria e.t.c.. > >Ioannis >=20 >* Ioannis Vranos >* Programming pages: http://www.noicys.d2g.com >* Alternative URL: http://run.to/noicys Flavio de Souza fla...@ne... ICQ:78458203 Sert=E3ozinho - SP - Brasil |