|
From: Daniel G. <sp...@ho...> - 2001-10-22 18:06:48
|
<html><div style='background-color:'><DIV>
<P>Are you sure? I was taught to always ALWAYS do <iostream.h> . Even when they spoke about it in my course they said iostream.h<BR><BR></P></DIV>
<DIV></DIV>
<DIV></DIV>>From: "Ioannis Vranos" <NO...@YA...>
<DIV></DIV>>To: "Dev-C++" <DEV...@LI...>
<DIV></DIV>>Subject: RE: [Dev-C++] using strings
<DIV></DIV>>Date: Mon, 22 Oct 2001 14:23:17 +0200
<DIV></DIV>>
<DIV></DIV>>string.h is the C header file. ANSI C++ header files are without .h and
<DIV></DIV>>more properly written:
<DIV></DIV>>
<DIV></DIV>>#include <IOSTREAM>
<DIV></DIV>>#include <IOMANIP>// For setw()
<DIV></DIV>>#include <FSTREAM>// For file I/O
<DIV></DIV>>#include <STRING>
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>int main()
<DIV></DIV>>{
<DIV></DIV>> using namespace std;
<DIV></DIV>>
<DIV></DIV>> string s1;
<DIV></DIV>> char pause;
<DIV></DIV>>
<DIV></DIV>> cin >> s1;
<DIV></DIV>> cout << endl << s1 << endl;
<DIV></DIV>> cout << "pause";
<DIV></DIV>> cin >> pause;
<DIV></DIV>>
<DIV></DIV>>}
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>return 0; is not needed in ANSI C++. If in main() you do not return any
<DIV></DIV>>value, 0 is automatically returned to the system.
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>Ioannis
<DIV></DIV>>
<DIV></DIV>>* Ioannis Vranos
<DIV></DIV>>* Programming pages: http://www.noicys.f2s.com
<DIV></DIV>><HTTP: www.noicys.f2s.com />
<DIV></DIV>>* Alternative URL: http://run.to/noicys
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>-----Original Message-----
<DIV></DIV>>From: dev...@li...
<DIV></DIV>>[mailto:dev...@li...] On Behalf Of Daniel
<DIV></DIV>>Anderson
<DIV></DIV>>Sent: Sunday, October 21, 2001 7:38 PM
<DIV></DIV>>To: dev...@li...
<DIV></DIV>>Subject: [Dev-C++] using strings
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>Hello,
<DIV></DIV>>A seemingly simple problem has stumped me so far. I cannot figure out
<DIV></DIV>>how to use simple strings in my programs. Do I need to add the
<DIV></DIV>><CSTRING.H> library? If so, my compiler says it can't find it- can I
<DIV></DIV>>download this somewhere? I know I can get around this problem by using
<DIV></DIV>>an array of chars, but I want to be able to use strings. I am using Dev
<DIV></DIV>>4.01 and the mingw compiler 2.95.2-1. A thousand thanks for any help.
<DIV></DIV>>
<DIV></DIV>>D
<DIV></DIV>>
<DIV></DIV>>When I try to compile this program, I can a 'string' undeclared (first
<DIV></DIV>>use this function) error.
<DIV></DIV>>// start
<DIV></DIV>>
<DIV></DIV>>#include <IOSTREAM.H>
<DIV></DIV>>#include <IOMANIP.H>// For setw()
<DIV></DIV>>#include <FSTREAM.H>// For file I/O
<DIV></DIV>>#include <STRING.H>
<DIV></DIV>>
<DIV></DIV>>using namespace std;
<DIV></DIV>>
<DIV></DIV>>int main()
<DIV></DIV>>{
<DIV></DIV>> string s1;
<DIV></DIV>> char pause;
<DIV></DIV>>
<DIV></DIV>> cin >> s1;
<DIV></DIV>> cout << endl << s1 << endl;
<DIV></DIV>> cout << "pause";
<DIV></DIV>> cin >> pause;
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>> return 0;
<DIV></DIV>>}
<DIV></DIV>>
<DIV></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: Ioannis V. <no...@ya...> - 2001-10-22 19:43:43
|
Positive. ANSI C++ header files have no .h and all their contents are defined and declared in std namespace. =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 =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Daniel Glenfield Sent: Monday, October 22, 2001 8:06 PM To: dev...@li... Subject: RE: [Dev-C++] using strings Are you sure? I was taught to always ALWAYS do <iostream.h> . Even when they spoke about it in my course they said iostream.h >From: "Ioannis Vranos"=20 >To: "Dev-C++"=20 >Subject: RE: [Dev-C++] using strings=20 >Date: Mon, 22 Oct 2001 14:23:17 +0200=20 >=20 >string.h is the C header file. ANSI C++ header files are without .h and >more properly written:=20 >=20 >#include=20 >#include // For setw()=20 >#include // For file I/O=20 >#include=20 >=20 >=20 >=20 >int main()=20 >{=20 > using namespace std;=20 >=20 > string s1;=20 > char pause;=20 >=20 > cin >> s1;=20 > cout << endl << s1 << endl;=20 > cout << "pause";=20 > cin >> pause;=20 >=20 >}=20 >=20 >=20 >return 0; is not needed in ANSI C++. If in main() you do not return any >value, 0 is automatically returned to the system.=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 >=20 >-----Original Message-----=20 >From: dev...@li...=20 >[mailto:dev...@li...] On Behalf Of Daniel=20 >Anderson=20 >Sent: Sunday, October 21, 2001 7:38 PM=20 >To: dev...@li...=20 >Subject: [Dev-C++] using strings=20 >=20 >=20 >Hello,=20 >A seemingly simple problem has stumped me so far. I cannot figure out=20 >how to use simple strings in my programs. Do I need to add the=20 > library? If so, my compiler says it can't find it- can I=20 >download this somewhere? I know I can get around this problem by using=20 >an array of chars, but I want to be able to use strings. I am using Dev >4.01 and the mingw compiler 2.95.2-1. A thousand thanks for any help.=20 >=20 >D=20 >=20 >When I try to compile this program, I can a 'string' undeclared (first=20 >use this function) error.=20 >// start=20 >=20 >#include=20 >#include // For setw()=20 >#include // For file I/O=20 >#include=20 >=20 >using namespace std;=20 >=20 >int main()=20 >{=20 > string s1;=20 > char pause;=20 >=20 > cin >> s1;=20 > cout << endl << s1 << endl;=20 > cout << "pause";=20 > cin >> pause;=20 >=20 >=20 > return 0;=20 >}=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 _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20 |
|
From: Ioannis V. <no...@ya...> - 2001-10-22 19:52:17
|
Also check http://www.research.att.com/~bs/3rd_notes.pdf which is a peice of Stroustrup's Special Edition. Be sure to check http://www.research.att.com/~bs which is the page of Bjarne Stroustrup (the creator of C++).=20 =20 This is the page of Special Edition: http://www.research.att.com/~bs/3rd.html =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 =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Daniel Glenfield Sent: Monday, October 22, 2001 8:06 PM To: dev...@li... Subject: RE: [Dev-C++] using strings Are you sure? I was taught to always ALWAYS do <iostream.h> . Even when they spoke about it in my course they said iostream.h >From: "Ioannis Vranos"=20 >To: "Dev-C++"=20 >Subject: RE: [Dev-C++] using strings=20 >Date: Mon, 22 Oct 2001 14:23:17 +0200=20 >=20 >string.h is the C header file. ANSI C++ header files are without .h and >more properly written:=20 >=20 >#include=20 >#include // For setw()=20 >#include // For file I/O=20 >#include=20 >=20 >=20 >=20 >int main()=20 >{=20 > using namespace std;=20 >=20 > string s1;=20 > char pause;=20 >=20 > cin >> s1;=20 > cout << endl << s1 << endl;=20 > cout << "pause";=20 > cin >> pause;=20 >=20 >}=20 >=20 >=20 >return 0; is not needed in ANSI C++. If in main() you do not return any >value, 0 is automatically returned to the system.=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 >=20 >-----Original Message-----=20 >From: dev...@li...=20 >[mailto:dev...@li...] On Behalf Of Daniel=20 >Anderson=20 >Sent: Sunday, October 21, 2001 7:38 PM=20 >To: dev...@li...=20 >Subject: [Dev-C++] using strings=20 >=20 >=20 >Hello,=20 >A seemingly simple problem has stumped me so far. I cannot figure out=20 >how to use simple strings in my programs. Do I need to add the=20 > library? If so, my compiler says it can't find it- can I=20 >download this somewhere? I know I can get around this problem by using=20 >an array of chars, but I want to be able to use strings. I am using Dev >4.01 and the mingw compiler 2.95.2-1. A thousand thanks for any help.=20 >=20 >D=20 >=20 >When I try to compile this program, I can a 'string' undeclared (first=20 >use this function) error.=20 >// start=20 >=20 >#include=20 >#include // For setw()=20 >#include // For file I/O=20 >#include=20 >=20 >using namespace std;=20 >=20 >int main()=20 >{=20 > string s1;=20 > char pause;=20 >=20 > cin >> s1;=20 > cout << endl << s1 << endl;=20 > cout << "pause";=20 > cin >> pause;=20 >=20 >=20 > return 0;=20 >}=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 _______________________________________________ Dev-cpp-users mailing list Dev...@li... https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20 |