delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/16/21:59:49

From: "Justin Skorupa" <skorupa AT thegrid DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: cout.setf(ios_base::boolalpha)
Lines: 32
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
Message-ID: <KF9O3.2686$Ti4.258004@alfalfa.thegrid.net>
Date: Sat, 16 Oct 1999 18:29:26 -0700
NNTP-Posting-Host: 209.162.42.209
X-Complaints-To: abuse AT thegrid DOT net
X-Trace: alfalfa.thegrid.net 940123882 209.162.42.209 (Sat, 16 Oct 1999 18:31:22 PDT)
NNTP-Posting-Date: Sat, 16 Oct 1999 18:31:22 PDT
Organization: The Grid
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am relatively new to C++. However, I am tutoring myself on the differences
of int expressions and bool expressions. The gnu gxx comipler doesn't
recognize 'ios_base::boolalpha' argument in the statement
'cout.setf(ios_base::boolalpha)'. I have since learned that the 'ios_base'
should be replaced with 'ios' in the current implementation of g++. With
what argument do I replace 'boolalpha'? The compiler gives the error that
'boolalpha' is not a member of type 'ios'. obviously, being somewhat new I
am at a loss. Please help and thanks in advance!

Justin

#include<iostream>
using namespace std;
int main()
{
    int x;

 cout << "\nThe expression x = 100 has the value ";
    cout << (x = 100) << "\n";
    cout << "The expression x < 3 has the value ";
    cout << (x < 3) << "\n";
    cout << "The expression x > 3 has the value ";
    cout << (x > 3) << "\n";
    cout.setf(ios_base::boolalpha);
    cout << "The expression x < 3 has the value ";
    cout << (x < 3) << "\n";
    cout << "The expression x > 3 has the value ";
    cout << (x > 3) << "\n";
 return 0;
}


- Raw text -


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