delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/03/14:52:01

From: "Valmont" <news AT valmont1 DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Commands?
Date: Sun, 3 Oct 1999 18:44:18 +0100
Organization: Customer of Planet Online
Lines: 44
Message-ID: <7t84l8$7bp$1@news4.svr.pol.co.uk>
NNTP-Posting-Host: modem-237.name65.dialup.pol.co.uk
X-Trace: news4.svr.pol.co.uk 938972648 7545 62.136.192.237 (3 Oct 1999 17:44:08 GMT)
NNTP-Posting-Date: 3 Oct 1999 17:44:08 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm a complete novice to programming in C++, and am having a bit of a
headache with the headers.

I'm learning from a book by Horstmann ("Computing Concepts with C++
Essentials 2nd edition") which uses all ANSI standard commands, but the
newest version of DJGPP that I am using doesn't recognise half of them - in
particular those relating to strings.

How can I get a list of the commands that each library contains - ie what's
in <string>, <iostream>, <cmath>, etc?  I don't seem to be getting any help
from the programme or its FAQs about this.

All I want to do is assign a "string" variable and slice it up into little
sections (like below), but it just won't let me!!


#include <iostream.h>
#include <string.h>

int main (void)
{
 string figure, f1, f2;
 int word_length, position, position1;

 cout << "Give me a number between 999 and 99999 -> ";
 cin >> figure;

 word_length = figure.length();

 position = Long%3;
 position1 = position - 1;

 f1 = figure.substr(0,position-1);
 f2 = figure.substr(position, word_length);

 figure = f1 + "," + f2;

 cout << "With a comma that is written " << figure << ".";

 return 0;
}



- Raw text -


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