dev-cpp-users Mailing List for Dev-C++ (Page 662)
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: Ioannis V. <no...@ya...> - 2001-10-04 21:14:12
|
Borland C++ Builder 5 is the best C++ RAD development tool currently for Windows. :) =20 This AP committee of yours must be something to US schools, fortunately here there is chaos and anyone is on his own. :) I think that too much committees can be a problem. =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Jason Silverman Sent: Thursday, October 04, 2001 10:02 PM To: dev...@li... Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Let me clarify that, I didn't mean that the AP committee might be RIGHT in what they think, I'm just disappointed we (possibly) can't use in school it because of that. :( =20 Jay ----- Original Message -----=20 From: Jason <mailto:mys...@op...> Silverman=20 To: Dev-C++ <mailto:dev...@li...> =20 Sent: Thursday, October 04, 2001 3:58 PM Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Though doesn't it not have the approval of the AP committee or some junk like that? They make us use metrowerks in school, and the teacher was mentioning something of the such one day about one of borland's products. =20 Jason ----- Original Message -----=20 From: Sayajin <mailto:sa...@if...> =20 To: Ioannis Vranos <mailto:no...@ya...> ; Dev-C++ <mailto:dev...@li...> =20 Sent: Thursday, October 04, 2001 8:56 AM Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Borland Builder C++ is the best ! And we have an utility which convert the files projets of Visual to files projets for Builder ! ! ! |
|
From: Jason S. <mys...@op...> - 2001-10-04 20:02:02
|
Let me clarify that, I didn't mean that the AP committee might be RIGHT in what they think, I'm just disappointed we (possibly) can't use in school it because of that. :(
Jay
----- Original Message -----
From: Jason Silverman
To: Dev-C++
Sent: Thursday, October 04, 2001 3:58 PM
Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER
Though doesn't it not have the approval of the AP committee or some junk like that? They make us use metrowerks in school, and the teacher was mentioning something of the such one day about one of borland's products.
Jason
----- Original Message -----
From: Sayajin
To: Ioannis Vranos ; Dev-C++
Sent: Thursday, October 04, 2001 8:56 AM
Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER
Borland Builder C++ is the best ! And we have an utility which convert the
files projets of Visual to files projets for Builder ! ! !
|
|
From: Jason S. <mys...@op...> - 2001-10-04 19:58:51
|
Though doesn't it not have the approval of the AP committee or some junk like that? They make us use metrowerks in school, and the teacher was mentioning something of the such one day about one of borland's products. Jason ----- Original Message ----- From: Sayajin To: Ioannis Vranos ; Dev-C++ Sent: Thursday, October 04, 2001 8:56 AM Subject: Re: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER Borland Builder C++ is the best ! And we have an utility which convert the files projets of Visual to files projets for Builder ! ! ! |
|
From: Jason S. <mys...@op...> - 2001-10-04 19:55:01
|
Include conio.h and call the function textcolor(COLOR) GREEN, RED, BLUE, DARKBLUE, etc. Anyone know a way to get this to work in another compiler? Last year in school I did, and I want to do the same thing this year, but I really can't remember how. Tried copying conio.h and others from Dev-C++, but still ended up with some linking errors. Anyone know any sites to download conio from? Jason ----- Original Message ----- From: DD To: dev...@li... Sent: Thursday, October 04, 2001 9:12 AM Subject: [Dev-C++] Background Color Hi I would like to know if there is a way to change the background color of a C++ console program Thanks DD |
|
From: Ioannis V. <no...@ya...> - 2001-10-04 17:45:49
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf Of Jason
> Hardman
> Sent: Wednesday, October 03, 2001 6:04 PM
> To: Dev-C++
> Subject: Re: [Dev-C++] Help with functions
>=20
>=20
> I went ahead and created a faster algorithm anyway, it's the
> sortv2() function a the bottom. Note that the e-mail line length is
> cropped, so some of the comments will need to be straightened out=20
> before it will compile again.
>=20
> Jason.
>=20
>=20
> #include <cstdio> // all around useful header
> #include <cstdlib> // the rand() fuction is in this header
> #include <ctime> // for time()
> #include <iostream> // for cout and cin
> #include <cstring> // for strcpy()
>=20
> void sortv2(char str[]);
>=20
> int main(int argc, char *argv[])
> {
> using namespace std; // allow implicit use of std namespace
>=20
> // Random number generation
> int num;
> srand((unsigned) time(NULL)); // give the rand() function a seed
> // I use the time because it's not likely to be the same each=20
> time
> // the program is run. There may be a better way of doing=20
> this?
There is no need for casting since it returns always positive values,
and -1 only in case of error. The conversion is a regular built in
conversion from an integer type to an unsigned integer type. Also
casting a negative number to an unsigned type has the same truncation
effects as the direct assignment without casting. Also in case of
casting always try to use the C++ style casts and not the C style cast.
>=20
> for(int i =3D 0; i < 10; ++i)
> {
> num =3D (rand() % 99) + 1; // A random number between 1 and =
100.
> cout << "A random number " << i + 1 << ": " << num << endl;
> }
>=20
> cout << endl;
>=20
> // Getting a character out of a string
> char a_string[] =3D "This is a string of text. Hello World!";
> cout << a_string << endl << "Enter a number between 1 and "
> << sizeof(a_string) - 1 << ": ";
> // the string is null terminated, so sizeof reports one=20
> bigger
> // than text
sizeof() always works for arrays declared locally or globally (and not
passed as a pointer argument to a function). So be careful with it, and
in case of char pointer arguments to function us strlen(p)+1 style; Also
always try to use C++ string type than C-style string type.
> cin >> num;
> cout << "The character at that number is: " << a_string[num-1] <<=20
> endl;
> // You don't need a function to get a single character out of=20
> a string
> // just use array access. This applies to std::string too.
> // don't forget... arrays are indexed from 0
>=20
> cout << endl;
>=20
> // Sorting a string in sequence
C++ provides enough sorting algorithms, try using one of them (probably=20
C++ sort() ).
> char str[80], str2[80]; // up to 80 chars
> cout << "Enter a string to be sorted in sequence (80 char MAX!)"
> << endl << ": ";
> gets(str); // get a string from user (part of <cstdio>)
> strcpy(str2, str); // make a copy
>=20
> // Begin sort (brute force)
> int i =3D 0, j =3D 0, k =3D 0; // index's
> char sorted[80], c;
> while(str[i])
> {
> while(str[i] =3D=3D ' ') ++i; // skip spaces
> if(!str[i]) break; // avoid end of line
> j =3D i;
> c =3D str[i];
> while(str[j])
> {
> if(str[j] =3D=3D c)
> {
> sorted[k] =3D c;
> str[j] =3D ' '; // don't get the same char twice
> ++k; // increment sorted index
> }
> ++j; // increment search index
> }
> ++i; // increment input index
> }
> sorted[k] =3D 0; // don't forget to null terminate string!
> cout << "Sorted string is: " << sorted << endl;
> // NB: there may be a better way to do it, but this works and=20
> you
> // don't really need anything faster for just 80 chars.
> // I leave it to you to perform size and type checking=20
> anywhere
>=20
> sortv2(str2); // I made a faster one anyway :)
> cout << "Sorted by V2 is : " << str2 << endl;
>=20
> system("PAUSE");
> return 0;
> }
>=20
>=20
> // another sort that should be faster (in theory)
> // for one it uses pointer arithmatic mainly which is faster // than
> array access, secondly it employs two single passes // of the string,=20
> rather than the multiple in the other version // one thing you could=20
> note is that if you give this function // an already sorted string it=20
> will take longer than the v1 sort // method. void sortv2(char str[])=20
> // pass it the string to be sorted {
> char ts[80], *pstr, *pts;
> int count[128], *pc;
> pc =3D count;
> for(int i =3D 0; i < 128; ++i) *pc++ =3D 0; // clear all of
> count to zero
> pstr =3D str;
> while(*pstr) ++count[*pstr++]; // count instances of each=20
> character
> pstr =3D str;
> pts =3D ts;
> while(*pstr)
> {
> while(*pstr =3D=3D ' ') ++pstr; // ignore spaces
> if(!*pstr) break; // stop at EOL
> for(; count[*pstr]; --count[*pstr])
> *pts++ =3D *pstr;
> ++pstr;
> }
> *pts =3D 0; // NULL terminate
> strcpy(str, ts); // copy it over original string
>=20
> }
>=20
>=20
> _______________________________________________
> Dev-cpp-users mailing list Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2001-10-04 17:13:25
|
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf Of Jason
> Hardman
> Sent: Wednesday, October 03, 2001 6:04 PM
> To: Dev-C++
> Subject: Re: [Dev-C++] Help with functions
>=20
>=20
> I went ahead and created a faster algorithm anyway, it's the
> sortv2() function a the bottom. Note that the e-mail line length is
> cropped, so some of the comments will need to be straightened out=20
> before it will compile again.
>=20
> Jason.
>=20
>=20
> #include <cstdio> // all around useful header
> #include <cstdlib> // the rand() fuction is in this header
> #include <ctime> // for time()
> #include <iostream> // for cout and cin
> #include <cstring> // for strcpy()
>=20
> void sortv2(char str[]);
>=20
> int main(int argc, char *argv[])
> {
> using namespace std; // allow implicit use of std namespace
>=20
> // Random number generation
> int num;
> srand((unsigned) time(NULL)); // give the rand() function a seed
> // I use the time because it's not likely to be the same each=20
> time
> // the program is run. There may be a better way of doing=20
> this?
There is no need for casting since it returns always positive values,
and -1 only in case of error. The conversion is a regular built in
conversion from an integer type to an unsigned integer type. Also
casting a negative number to an unsigned type has the same truncation
effects as the direct assignment without casting. Also in case of
casting always try to use the C++ style casts and not the C style cast.
>=20
> for(int i =3D 0; i < 10; ++i)
> {
> num =3D (rand() % 99) + 1; // A random number between 1 and =
100.
> cout << "A random number " << i + 1 << ": " << num << endl;
> }
>=20
> cout << endl;
>=20
> // Getting a character out of a string
> char a_string[] =3D "This is a string of text. Hello World!";
> cout << a_string << endl << "Enter a number between 1 and "
> << sizeof(a_string) - 1 << ": ";
> // the string is null terminated, so sizeof reports one=20
> bigger
> // than text
sizeof() always works for arrays declared locally or globally (and not
passed as a pointer argument to a function). So be careful with it, and
in case of char pointer arguments to function us strlen(p)+1 style; Also
always try to use C++ string type than C-style string type.
> cin >> num;
> cout << "The character at that number is: " << a_string[num-1] <<=20
> endl;
> // You don't need a function to get a single character out of=20
> a string
> // just use array access. This applies to std::string too.
> // don't forget... arrays are indexed from 0
>=20
> cout << endl;
>=20
> // Sorting a string in sequence
C++ provides enough sorting algorithms, try using one of them (probably=20
C++ sort() ).
> char str[80], str2[80]; // up to 80 chars
> cout << "Enter a string to be sorted in sequence (80 char MAX!)"
> << endl << ": ";
> gets(str); // get a string from user (part of <cstdio>)
> strcpy(str2, str); // make a copy
>=20
> // Begin sort (brute force)
> int i =3D 0, j =3D 0, k =3D 0; // index's
> char sorted[80], c;
> while(str[i])
> {
> while(str[i] =3D=3D ' ') ++i; // skip spaces
> if(!str[i]) break; // avoid end of line
> j =3D i;
> c =3D str[i];
> while(str[j])
> {
> if(str[j] =3D=3D c)
> {
> sorted[k] =3D c;
> str[j] =3D ' '; // don't get the same char twice
> ++k; // increment sorted index
> }
> ++j; // increment search index
> }
> ++i; // increment input index
> }
> sorted[k] =3D 0; // don't forget to null terminate string!
> cout << "Sorted string is: " << sorted << endl;
> // NB: there may be a better way to do it, but this works and=20
> you
> // don't really need anything faster for just 80 chars.
> // I leave it to you to perform size and type checking=20
> anywhere
>=20
> sortv2(str2); // I made a faster one anyway :)
> cout << "Sorted by V2 is : " << str2 << endl;
>=20
> system("PAUSE");
> return 0;
> }
>=20
>=20
> // another sort that should be faster (in theory)
> // for one it uses pointer arithmatic mainly which is faster // than
> array access, secondly it employs two single passes // of the string,=20
> rather than the multiple in the other version // one thing you could=20
> note is that if you give this function // an already sorted string it=20
> will take longer than the v1 sort // method. void sortv2(char str[])=20
> // pass it the string to be sorted {
> char ts[80], *pstr, *pts;
> int count[128], *pc;
> pc =3D count;
> for(int i =3D 0; i < 128; ++i) *pc++ =3D 0; // clear all of
> count to zero
> pstr =3D str;
> while(*pstr) ++count[*pstr++]; // count instances of each=20
> character
> pstr =3D str;
> pts =3D ts;
> while(*pstr)
> {
> while(*pstr =3D=3D ' ') ++pstr; // ignore spaces
> if(!*pstr) break; // stop at EOL
> for(; count[*pstr]; --count[*pstr])
> *pts++ =3D *pstr;
> ++pstr;
> }
> *pts =3D 0; // NULL terminate
> strcpy(str, ts); // copy it over original string
>=20
> }
>=20
>=20
> _______________________________________________
> Dev-cpp-users mailing list Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
|
|
From: Ioannis V. <no...@ya...> - 2001-10-04 17:13:23
|
It is in the stores in my country, you can see prices at Borland's website (or amazon, e.t.c.). =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys -----Original Message----- From: Daniel Glenfield [mailto:sp...@ho...]=20 Sent: Thursday, October 04, 2001 2:36 PM To: no...@ya... Subject: RE: [Dev-C++] Thinking of getting a new compiler... is it available in stores, or do you have to buy it directly from them? how much would you say it costs? >From: "Ioannis Vranos"=20 >To:=20 >Subject: RE: [Dev-C++] Thinking of getting a new compiler...=20 >Date: Thu, 4 Oct 2001 15:04:56 +0200=20 >=20 >Microsoft's is 4 years old, try Borland C++ Builder 5 it has a RAD like >Visual Basic's (much better than Visual Basic to be accurate).=20 >=20 >=20 >Ioannis=20 >=20 >* Ioannis Vranos=20 >* Programming pages: http://www.noicys.f2s.com=20 >=20 >* Alternative URL: http://run.to/noicys=20 >=20 >-----Original Message-----=20 >From: dev...@li...=20 >[mailto:dev...@li...] On Behalf Of Daniel=20 >Glenfield=20 >Sent: Thursday, October 04, 2001 1:38 PM=20 >To: dev...@li...=20 >Subject: [Dev-C++] Thinking of getting a new compiler...=20 >=20 >=20 >=20 >I'm having so many problems with DEV with regards to directX8, demos not=20 >compiling no matter what I do, so I'm thinking of purchasing a compiler.=20 >Is microsoft's visual C++ the best one to get?=20 >=20 >=20 >=20 >=20 > _____=20 >=20 >Get your FREE download of MSN Explorer at http://explorer.msn.com=20 >=20 >_______________________________________________ Dev-cpp-users mailing=20 >list Dev...@li...=20 >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20 >=20 _____ =20 Get your FREE download of MSN Explorer at http://explorer.msn.com <http://go.msn.com/bql/hmtag_itl_EN.asp>=20 |
|
From: Todd R. <tr...@ce...> - 2001-10-04 14:26:52
|
Exactly! I don't know but it has some of my students and I = reconsidering Visual C++ (Ugh!). If anybody has any ideas please help. =20 -----Original Message----- From: Stein Nyg=E5rd [mailto:ste...@ge...]=20 Sent: Saturday, September 29, 2001 10:11 AM To: dev...@li... Subject: SV: [Dev-C++] Out of Memory Error =20 WOW!! =20 I get the exact same error in my projects... and, sometimes I can't = even quit the program. What is it? -----Oprindelig meddelelse----- Fra: dev...@li... [mailto:dev...@li...]P=E5 vegne af Todd = Ross Sendt: 28. september 2001 17:01 Til: dev...@li... Emne: [Dev-C++] Out of Memory Error Hi: =20 I am new to Dev-C++. Sometimes I get "Out of Memory" errors when I try = to close windows in a project. The file does not have to have a lot of = code in it. In fact the file can be empty and produce the problem. Has = anybody encountered this? If so, is there a remedy? =20 Thanks! =20 =20 |
|
From: Terrell D L. <ter...@ya...> - 2001-10-04 14:13:25
|
unsubscribe end |
|
From: People == D. <el...@ho...> - 2001-10-04 13:22:01
|
I am looking for a good tutorial on how to play and modify wavs from VC++. Also, I am looking for a good tutorial on how to take real time input , like from a mike, and modify the sounds to make it sounds secret agent like. Any replys would be great Elon _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp |
|
From: DD <pra...@ba...> - 2001-10-04 13:14:54
|
Hi I would like to know if there is a way to change the background color of a C++ console program Thanks DD |
|
From: Sayajin <sa...@if...> - 2001-10-04 12:56:24
|
Borland Builder C++ is the best ! And we have an utility which convert the files projets of Visual to files projets for Builder ! ! ! ----- Original Message ----- From: "Ioannis Vranos" <no...@ya...> To: "Dev-C++" <dev...@li...> Sent: Thursday, October 04, 2001 3:02 PM Subject: RE: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Albert Vilella Bertran > Sent: Thursday, October 04, 2001 11:49 AM > To: DevC MAILING List > Subject: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER > > > Hello, > I wonder if anybody knows the "ANSI C" way to: > > (1) Allow the use of "delete" key or "supr" key while you are > writing a long word in a scanf() and you mistype a key. I > always get the "[[3~" symbols and so on. You can always use backspace... > > (2) For 1 character scanf, there is any "ANSI C" way to press > the char and not to need to press ENTER then? This feature is system dependend but on PCs the input stream is cached till the ENTER is pressed so although this behavior is not defined by ANSI, you can't. However you can use system extensions like getche() defined in conio.h. > > Thanks, and yes, I'm a beginner! That's the point we all passed from. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________________________________________________ ifrance.com, l'email gratuit le plus complet de l'Internet ! vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... http://www.ifrance.com/_reloc/email.emailif |
|
From: Ioannis V. <no...@ya...> - 2001-10-04 12:12:26
|
> -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf=20 > Of Albert Vilella Bertran > Sent: Thursday, October 04, 2001 11:49 AM > To: DevC MAILING List > Subject: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER >=20 >=20 > Hello, > I wonder if anybody knows the "ANSI C" way to: >=20 > (1) Allow the use of "delete" key or "supr" key while you are=20 > writing a long word in a scanf() and you mistype a key. I=20 > always get the "[[3~" symbols and so on. You can always use backspace... >=20 > (2) For 1 character scanf, there is any "ANSI C" way to press=20 > the char and not to need to press ENTER then? This feature is system dependend but on PCs the input stream is cached till the ENTER is pressed so although this behavior is not defined by ANSI, you can't. However you can use system extensions like getche() defined in conio.h. >=20 > Thanks, and yes, I'm a beginner! That's the point we all passed from. :) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |
|
From: Ioannis V. <no...@ya...> - 2001-10-04 12:04:46
|
Microsoft's is 4 years old, try Borland C++ Builder 5 it has a RAD like Visual Basic's (much better than Visual Basic to be accurate). =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Daniel Glenfield Sent: Thursday, October 04, 2001 1:38 PM To: dev...@li... Subject: [Dev-C++] Thinking of getting a new compiler... I'm having so many problems with DEV with regards to directX8, demos not compiling no matter what I do, so I'm thinking of purchasing a compiler. Is microsoft's visual C++ the best one to get? _____ =20 Get your FREE download of MSN Explorer at http://explorer.msn.com <http://go.msn.com/bql/hmtag_itl_EN.asp>=20 _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20 |
|
From: Daniel G. <sp...@ho...> - 2001-10-04 11:37:58
|
<html><div style='background-color:'><DIV> <P>I'm having so many problems with DEV with regards to directX8, demos not compiling no matter what I do, so I'm thinking of purchasing a compiler. Is microsoft's visual C++ the best one to get?<BR><BR></P></DIV></div><br clear=all><hr>Get your FREE download of MSN Explorer at <a href='http://go.msn.com/bql/hmtag_itl_EN.asp'>http://explorer.msn.com</a><br></html> |
|
From: Jason H. <jas...@bt...> - 2001-10-04 11:14:25
|
There is a swap() function in the standard template library's <algorithm> header. In theory they are all in the std namespace, but the current MinGW compiler used with Dev-C++ isn't that standards compliant yet, so the std namespace is part of the global namespace. On the whole a swap function is easy to write anyway. Jason. ----- Original Message ----- From: "Mansoor Nathani" <man...@sy...> To: <dev...@li...> Sent: Thursday, October 04, 2001 5:09 AM Subject: [Dev-C++] Thankyou > Thank you for your swift replies .. > > I appologise, but I am a Grade 12 student who has a terrible teacher and > an assignment due. That explains why I was asking silly questions. > > I need one more thing.. > > what library do I need to include for the > > swap(...) function? > > M.N > > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Jason H. <jas...@bt...> - 2001-10-04 11:14:23
|
I'm not too upto date on the current standard for ANSI C as I use C++ more, but I think that the gets() (stdio.h) is in ANSI C and that will allow you to get a string and it will handle the delete key too. It's main flaw is that it doesn't check if you type in more chars than are in the string array. The only other way to do it is to write your own gets type of function, and include handling for special keys. For a sinle character I would normaly use getch() or getche() (conio.h), but I'm not so sure that they are ANCI C (anyone else know?). Another way would be to use getc()(stdio.h) and tell it to get input from "stdin", i.e. char c; c = getc(stdin); I don't know if that works, but it should. Jason. ----- Original Message ----- From: "Albert Vilella Bertran" <vil...@ya...> To: "DevC MAILING List" <dev...@li...> Sent: Thursday, October 04, 2001 10:48 AM Subject: [Dev-C++] DELETE/SUPR in ANSI C + Get a char without ENTER > Hello, > I wonder if anybody knows the "ANSI C" way to: > > (1) Allow the use of "delete" key or "supr" key while you are writing a long > word in > a scanf() and you mistype a key. > I always get the "[[3~" symbols and so on. > > (2) For 1 character scanf, there is any "ANSI C" way to press the char and not > to > need to press ENTER then? > > Thanks, and yes, I'm a beginner! > > _______________________________________________________________ > Do You Yahoo!? > Yahoo! Messenger: Comunicación instantánea gratis con tu gente - > http://messenger.yahoo.es > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
|
From: Jason H. <jas...@bt...> - 2001-10-04 10:35:16
|
I went ahead and created a faster algorithm anyway, it's the sortv2()
function a the bottom.
Note that the e-mail line length is cropped, so some of the comments will
need to be straightened out before it will compile again.
Jason.
#include <cstdio> // all around useful header
#include <cstdlib> // the rand() fuction is in this header
#include <ctime> // for time()
#include <iostream> // for cout and cin
#include <cstring> // for strcpy()
void sortv2(char str[]);
int main(int argc, char *argv[])
{
using namespace std; // allow implicit use of std namespace
// Random number generation
int num;
srand((unsigned) time(NULL)); // give the rand() function a seed
// I use the time because it's not likely to be the same each time
// the program is run. There may be a better way of doing this?
for(int i = 0; i < 10; ++i)
{
num = (rand() % 99) + 1; // A random number between 1 and 100.
cout << "A random number " << i + 1 << ": " << num << endl;
}
cout << endl;
// Getting a character out of a string
char a_string[] = "This is a string of text. Hello World!";
cout << a_string << endl << "Enter a number between 1 and "
<< sizeof(a_string) - 1 << ": ";
// the string is null terminated, so sizeof reports one bigger
// than text
cin >> num;
cout << "The character at that number is: " << a_string[num-1] << endl;
// You don't need a function to get a single character out of a
string
// just use array access. This applies to std::string too.
// don't forget... arrays are indexed from 0
cout << endl;
// Sorting a string in sequence
char str[80], str2[80]; // up to 80 chars
cout << "Enter a string to be sorted in sequence (80 char MAX!)"
<< endl << ": ";
gets(str); // get a string from user (part of <cstdio>)
strcpy(str2, str); // make a copy
// Begin sort (brute force)
int i = 0, j = 0, k = 0; // index's
char sorted[80], c;
while(str[i])
{
while(str[i] == ' ') ++i; // skip spaces
if(!str[i]) break; // avoid end of line
j = i;
c = str[i];
while(str[j])
{
if(str[j] == c)
{
sorted[k] = c;
str[j] = ' '; // don't get the same char twice
++k; // increment sorted index
}
++j; // increment search index
}
++i; // increment input index
}
sorted[k] = 0; // don't forget to null terminate string!
cout << "Sorted string is: " << sorted << endl;
// NB: there may be a better way to do it, but this works and you
// don't really need anything faster for just 80 chars.
// I leave it to you to perform size and type checking anywhere
sortv2(str2); // I made a faster one anyway :)
cout << "Sorted by V2 is : " << str2 << endl;
system("PAUSE");
return 0;
}
// another sort that should be faster (in theory)
// for one it uses pointer arithmatic mainly which is faster
// than array access, secondly it employs two single passes
// of the string, rather than the multiple in the other version
// one thing you could note is that if you give this function
// an already sorted string it will take longer than the v1 sort
// method.
void sortv2(char str[]) // pass it the string to be sorted
{
char ts[80], *pstr, *pts;
int count[128], *pc;
pc = count;
for(int i = 0; i < 128; ++i) *pc++ = 0; // clear all of count to zero
pstr = str;
while(*pstr) ++count[*pstr++]; // count instances of each character
pstr = str;
pts = ts;
while(*pstr)
{
while(*pstr == ' ') ++pstr; // ignore spaces
if(!*pstr) break; // stop at EOL
for(; count[*pstr]; --count[*pstr])
*pts++ = *pstr;
++pstr;
}
*pts = 0; // NULL terminate
strcpy(str, ts); // copy it over original string
}
|
|
From: <vil...@ya...> - 2001-10-04 09:51:58
|
Hello, I wonder if anybody knows the "ANSI C" way to: (1) Allow the use of "delete" key or "supr" key while you are writing a long word in a scanf() and you mistype a key. I always get the "[[3~" symbols and so on. (2) For 1 character scanf, there is any "ANSI C" way to press the char and not to need to press ENTER then? Thanks, and yes, I'm a beginner! _______________________________________________________________ Do You Yahoo!? Yahoo! Messenger: Comunicación instantánea gratis con tu gente - http://messenger.yahoo.es |
|
From: Mansoor N. <man...@sy...> - 2001-10-04 04:12:00
|
Thank you for your swift replies .. I appologise, but I am a Grade 12 student who has a terrible teacher and an assignment due. That explains why I was asking silly questions. I need one more thing.. what library do I need to include for the swap(...) function? M.N |
|
From: <mi...@ju...> - 2001-10-03 20:05:13
|
Hi, this is my first posting. My question is if you can only use the
system("pause") and system("cls") functions? Is there a way to use good
ol' getch() and clrscr()? And also, are there any other system()
functions? |
|
From: Jason H. <jas...@bt...> - 2001-10-03 13:12:05
|
Hi, I notice you have done three posts so I'll answer them all here as best
I can. I have written a small console app to demonstrate them all too. I
don't know why as I guess that you should be learning this for yourself, but
it was fun for me.
I tried to post this earlier, but it never got through, so this is my second
try.
First of all for a random number you can use rand(). Some compilers provide
a RANDOM() macro, but I don't know about MinGW. It is best to give rand() a
seed using srand(), otherwise you are likely to get the same numbers every
time you run the program. I would use some value you know won't be the same
each time you run a program i.e. the time. To use rand() you need to include
<stdlib.h>; or <cstdlib> if you want to be c++ standard compliant.
To get a single character from a string, either a C string or a C++
std::string, then just use the [] operator with the relevant index. i.e.
char my_string[] = "HELLO";
char c = my_string[4]; // c is now "L"
if you want you can write your own function to do it in the way you want.
I'm not going to do that for you.
As for the sorting of a string in the way you want, I've written an
algorithm that works by going through your string and picking out each of
the letter as it comes to them in order, searching for the same ones and
skipping spaces. Have a look at my code below. There may be a better
algorithm around to do this, but why spend loads of time doing that unless
you are working hundreds of thousands of strings.
Heres my demo, it has been briefly tested and I can't see any great problems
with it:
#include <cstdio> // all around useful header
#include <cstdlib> // the rand() fuction is in this header, so don't forget
it
#include <ctime> // for time()
#include <iostream> // for cout and cin
int main(int argc, char *argv[])
{
using namespace std; // allow implicit use of std namespace
// Random number generation
int num;
srand((unsigned) time(NULL)); // give the rand() function a seed
// I use the time because it's not likely to be the same each time
// the program is run. There may be a better way of doing this?
for(int i = 0; i < 10; ++i)
{
num = (rand() % 99) + 1; // A random number between 1 and 100.
cout << "A random number " << i + 1 << ": " << num << endl;
}
cout << endl;
// Getting a character out of a string
char a_string[] = "This is a string of text. Hello World!";
cout << a_string << endl << "Enter a number between 1 and "
<< sizeof(a_string) - 1 << ": ";
// the string is null terminated, so sizeof reports one bigger
// than text
cin >> num;
cout << "The character at that number is: " << a_string[num-1] << endl;
// You don't need a function to get a single character out of a
string
// just use array access. This applies to std::string too.
// don't forget... arrays are indexed from 0
cout << endl;
// Sorting a string in sequence
char str[80]; // up to 80 chars
cout << "Enter a string to be sorted in sequence (80 char MAX!)"
<< endl << ": ";
gets(str); // get a string from user (part of <cstdio>)
// Begin sort (brute force)
int i = 0, j = 0, k = 0; // index's
char sorted[80], c;
while(str[i])
{
while(str[i] == ' ') ++i; // skip spaces
if(!str[i]) break; // avoid end of line
j = i;
c = str[i];
while(str[j])
{
if(str[j] == c)
{
sorted[k] = c;
str[j] = ' '; // don't get the same char twice
++k; // increment sorted index
}
++j; // increment search index
}
++i; // increment input index
}
sorted[k] = 0; // don't forget to null terminate string!
cout << "Sorted string is: " << sorted << endl;
// NB: there may be a better way to do it, but this works and you
// don't really need anything faster for just 80 chars.
// I leave it to you to perform size and type checking anywhere
system("PAUSE");
return 0;
}
----- Original Message -----
From: "Mansoor Nathani" <man...@sy...>
To: <dev...@li...>
Sent: Wednesday, October 03, 2001 12:12 AM
Subject: [Dev-C++] Help with functions
> Does any one know the functions for :
>
> Generating a random number (integer) between a given range.
>
> Extracting a character from a string: eg:
>
> ( "HELLO", 4 )
>
> that should output the fourth character : L
>
> Any help would be appreciated
>
> Mansoor
>
>
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: <We...@ha...> - 2001-10-03 12:00:57
|
Hi, I'm with a stupid problem! ;) When i open the Dev-C++ in my Win2k, i create a new project or open a project it show me the error: Could not create Code Cinoketion list file What is it ?? How to fix ?? Why it happends?? Thkz. Best Regards. [ ]'s |
|
From: Ioannis V. <no...@ya...> - 2001-10-03 09:57:38
|
I made some ommitions so i resend corrected.
The following code works for ASCII code *only* and for capitals only.
#include <string.h>
/* ... */
int i;
const int appearances[Z]=3D{0};
char buffer[80];
size_t slength;
/* You store the string to buffer here... */=20
slength=3Dstrlen(buffer);
for(i=3D0; i<slength; i++)
appearances[buffer[i]]++;
/* Now you have stored the number of appearances of each letter. */
The most important code was solved, now i guess you can think of
something to sort the letters (sorting function) according to your
criteria.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf=20
> Of Mansoor Nathani
> Sent: Wednesday, October 03, 2001 1:02 AM
> To: dev...@li...
> Subject: [Dev-C++] HELP !
>=20
>=20
> Hi this is my first post to the list
>=20
> I was wondering if someone could please help me out with this problem:
>=20
>=20
> The program should take an input of upto 80 characters and
> sort the characters into order according to the order of=20
> their appearance in the string, skipping spaces. Eg:
> MISSISSIPPI MUD would output: MMIIIISSSSPPUD
>=20
> Any help would be much appreciated..
>=20
> Mansoor Nathani
>=20
>=20
> _______________________________________________
> Dev-cpp-users mailing list Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
|
|
From: Ioannis V. <no...@ya...> - 2001-10-03 09:54:27
|
Hmm, that *is* boring. I assume C. The following code works for ASCII
code *only* and for capitals only.
#include <string.h>
/* ... */
int i;
const int appearances[Z]=3D{0};
char buffer[80];
size_t slength;
/* You store the string to buffer here... */
slength=3Dstrlen(buffer);
for(i=3D0; i<slength; i++)
appearances[buffer[i]];
/* Now you have stored the number of appearances of each letter. */
The most important code was solved, now i guess you can think of
something to sort the letters (sorting function) according to your
criteria.
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.f2s.com
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...=20
> [mailto:dev...@li...] On Behalf=20
> Of Mansoor Nathani
> Sent: Wednesday, October 03, 2001 1:02 AM
> To: dev...@li...
> Subject: [Dev-C++] HELP !
>=20
>=20
> Hi this is my first post to the list
>=20
> I was wondering if someone could please help me out with this problem:
>=20
>=20
> The program should take an input of upto 80 characters and=20
> sort the characters into order according to the order of=20
> their appearance in the string, skipping spaces. Eg:
> MISSISSIPPI MUD would output: MMIIIISSSSPPUD
>=20
> Any help would be much appreciated..
>=20
> Mansoor Nathani
>=20
>=20
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
|