| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: C++ for beginners? |
From: "Geo"
oh mama!!
You just gave me the missing piece to write my log analyzer THANK YOU!!
Bwahahahah.... my project is back on, it's soooo nice to not have to write
a stupid lotto picker program...
Geo.
"John Beckett" wrote in
message news:btu4q0p2p0483mflcfbk188br50qj8hfab{at}4ax.com...
> On Mon, 22 Nov 2004 05:59:16 -0500, "Geo"
wrote:
> >Are you saying there is a structure for a string type variable? We
learned
> >that only way to do a string was with an array of characters.
>
> First, you can use the bitwise operators like ^ (xor) on any "integer"
> type, i.e. char, int, long. You can also put "unsigned" in froont of
> each of these.
>
> Re "string": It is true there is no string in C++ itself, but the STL
> is considered to be part of C++ (I'm not up to date on whether there
> is a formal connection in the standard). In case you haven't seen a
> simple string example, here it is:
>
> #include
> #include
> using namespace std;
>
> void main()
> {
> string s1("Toast");
> string s2;
> string s3 = "Jam";
> s2 = "and";
> s1 = s1 + " " + s2 + " " + s3;
> cout << s1 << endl;
> }
>
> Enter the above in file S.cpp. Open S.cpp in VC6. Press F7 to compile.
> It will offer to make a default workspace. Put a breakpoint on the
> last line (press F9 at the curly brace), then press F5 to run the
> program At the breakpoint, press Alt+Tab to switch to the console
> output and admire the text "Toast and Jam".
>
> So, when I said that the compiler won't allow ^ with strings, I meant
> with STL strings. In the above we see the operator + used to
> concatenate strings. That works because the STL string defines
> operator+ to overload (replace) the normal arithmetic definition of +.
> However, it does not overload the ^ operator.
>
> I wouldn't complain too much to your teacher. I have shown you the
> pretty face of strings. You will do much teeth gnashing the first time
> you try to do something like search for text within a string. I can
> respect the point of view that in an introductory class you might
> choose to not grapple with the weirdness of STL strings. The
> documentation is unbelievable. If you want a laugh, put the cursor on
> "string" and press F1.
>
> John
>
--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)SEEN-BY: 633/267 270 5030/786 @PATH: 379/45 1 396/45 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.