www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/11/23/22:49:17

From: jason_hsu AT my-deja DOT com (Jason Hsu)
Newsgroups: comp.os.msdos.djgpp
Subject: REPOST: My <string> problem
Date: 23 Nov 2001 19:42:38 -0800
Organization: http://groups.google.com/
Lines: 21
Message-ID: <f7d9a152.0111231942.2e203d99@posting.google.com>
NNTP-Posting-Host: 24.18.171.165
X-Trace: posting.google.com 1006573359 15829 127.0.0.1 (24 Nov 2001 03:42:39 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 24 Nov 2001 03:42:39 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Here is my C++ code:

#include <iostream.h>
#include <string>	// include for C++ standard string class

int main()
{
  string stringA = "Nutcracker",
    stringB = "Sleeping Beauty",
    stringC = "Swan Lake";

  cout << "Length of stringA = " << stringA.length() << endl;
  cout << "Length of stringB = " << stringB.length() << endl;
  cout << "Length of stringC = " << stringC.length() << endl;
}

It compiles on the online C++ compiler at:
http://sant.bradley.edu/icp/compiler.html

However, the code does not compile on my machine.  I am using DJGPP on
a Windows 98 system and the gpp compiler.  What's wrong?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019