NetBeans or G++?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

NetBeans or G++?

Papa

This is code that, as far I can remember, worked well under MS-VS. Now that I am porting everything to NB/g++, I cant get this code to display all the spanish characters, just three appear.

Is this a NB's issue or a g++ issue?

The code is:

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <inttypes.h>
#include <locale>

using namespace std;
namespace abc {
    void ascii_all();
    void ascii_es();
    void ascii_all() {
        uint32_t ASCII_MAX = 255;
        std::wstring a;

        for (uint32_t i = 0; i <= ASCII_MAX; i++) {
            a = i;
            size_t w1/*, w2*/;
            if ( i < 10 ) w1 = 3; //Determine the width of the column
            else w1 = 2;
            wcout << setw( w1 )
                  << a
                  << setw( 6 )
                  << i;
        }
        wcout << L"\nThis are the ASCII character from 33 to 255" << std::endl;
    //    wcin.get();
    }
    void ascii_es() {
        std::vector<int> list;
        list.push_back( 160 );
        list.push_back( 193 );
        list.push_back( 130 );
        list.push_back( 144 );
        list.push_back( 161 );
        list.push_back( 214 );
        list.push_back( 162 );
        list.push_back( 224 );
        list.push_back( 168 );
        list.push_back( 164 );
        list.push_back( 165 );
        list.push_back( 163 );
        list.push_back( 233 );
        std::wcout << L"The size of the vector is: " << list.size() << std::endl;
        for(auto i : list)
        {
            std::wstring a;
            a = i;
            wcout << "Alt + " << i << ": " << a << std::endl;
        }
    }
}

int main(int argc, char** argv) {
    setlocale(LC_ALL, "");
    if (argc < 2)
        abc::ascii_es();
    else if (argv[1] == std::string("es"))
        abc::ascii_es();       
    else if (argv[1] == std::string("all"))
        abc::ascii_all();
    else
        abc::ascii_es();
}


Thanks for the help

Loading...