NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

NetBeans or G++?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
Papa



Joined: 17 Sep 2016
Posts: 23

PostPosted: Sat Apr 08, 2017 4:56 pm    Post subject: NetBeans or G++? Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo