#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    32
    Rep Power
    11

    I cant get setiosflags(ios::uppercase) to work


    I'm very new to c++ and i'm having trouble with the setiosflags. Here's my code.. (I used the php code coloring, just to make it a little easier to read)
    PHP Code:
    #include <iostream>
    #include <iomanip>

    using namespace std;
    int main()
    {
    cout << setiosflags(ios::right); 
    cout << setw(20) ;
    cout << "hello" << endl << endl;
    cout << setiosflags(ios::uppercase); 
    cout << setw(20) ;
    cout << "hello" << endl << endl;

    system("PAUSE"); 
    return 
    0;

    As you can see, it's a beginners script that doesn't do much but, we all have to start somewhere. Anyway, for some reason, I can't get the "uppercase" to work. It just sets it to the right again.

    Any help?

    Thanks in advance.
    Last edited by dcj1978; August 7th, 2003 at 02:26 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,473
    Rep Power
    15
    Microsoft says this:

    ios::uppercase Display uppercase A through F for hexadecimal values and E for scientific values.
    That means that the uppercase flag only applies when you are ouputting numbers in hexidecimal format; or in scientific notation, it will display 'E' instead of 'e'. In other words, when it displays numbers in certain formats, the letters used to display the numbers will be uppercase. It doesn't apply to strings.
    Last edited by 7stud; August 7th, 2003 at 02:50 PM.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    32
    Rep Power
    11
    Wow, that was fast. Thanks!

IMN logo majestic logo threadwatch logo seochat tools logo