Questions tagged as 'c++'

1
answer

What are the criteria for failbit and badbit in a std :: istream?

In a C ++ exercise, it is proposed to store a data (numeric, integer - eg, 4 or -3650 ) entered by the user through the console. This is an exercise to deal with exception handling and "defensive programming." Both the handout an...
asked by 03.10.2018 / 06:45
1
answer

struct array of characters

I'm having to remember programming in c ++ to teach a beginner class in programming logic. Subject this I have not seen for years. A struct was declared however when entering a string, the stream jumps to the next line. I looked for re...
asked by 26.10.2018 / 22:53
1
answer

How to create a Managed Thread in C ++ similar to the example in C #

In C # I use the following code to create the Managed Thread: Thread thread = new Thread(new ThreadStart(minhaFuncao)); In C ++ I did: using namespace System::Threading; . . Thread^ thread = gcnew Thread(gcnew ThreadStart(...
asked by 25.04.2014 / 14:17
1
answer

Logic of these operations bit by bit

I've already had a good time getting started in the emulator world, I decided to stop trying to make an emulator of a complex system and start with a very basic, emulator of CHIP-8, which is what many indicate in forums of emulation. Well let's...
asked by 18.06.2018 / 14:16
1
answer

How to copy array of integers to type Mat in OpenCV?

I would like to know how to copy an array of integers to an OpenCV Mat-type data? The following is an example I created to illustrate my goal, which corresponds to a given user-generated array (ranging from 0 to 255 - color variation in OpenCV)...
asked by 20.07.2017 / 15:00
2
answers

Difference from cout to printf in C ++

I want to know what difference I use in C ++ cout and printf , is it all the same?     
asked by 11.05.2017 / 22:59
1
answer

Specialize only one class template method

I have 2 basic types of classes, ClasseA and ClasseB . ClassA has a method that generates an integer, and ClassB has a method that generates a ClassA. I would like the method of a ClassC , if the template is a ClassA (or daughters) return...
asked by 07.11.2016 / 14:05
1
answer

How to vectorize code in C ++?

I would like to know how to vectorize code in C ++? because the material I found on the internet is a bit fake about it. I understand as a vectorization the use not only of vectors, but of doing in a single step a whole sequence of steps, tha...
asked by 21.09.2017 / 20:15
1
answer

When to choose between using a wide string or not?

When using wide ( std::wstring ) or a normal string ( std::string )?     
asked by 31.12.2017 / 11:30
2
answers

How to add elements in the "x" position of a std :: vector

How do I add an element to the position I indicate in std::vector ? Not to delete what you already have, but is to add in the middle. Here's an example: Let's suppose that within std::vector has the elements {1,2,3,4,5,6,7,8,9}...
asked by 30.01.2016 / 14:20