Questions tagged as 'c++'

2
answers

How do bit operators work?

I have the following code: volatile long Hex_To_int(long Hex , char bits) { long Hex_2_int; char byte; Hex_2_int = 0 ; for(byte = 0 ; byte < bits ; byte++) { if(Hex& (0x0001 << byte)) Hex_2_int += 1*(pow(2,byt...
asked by 07.10.2015 / 00:49
1
answer

Variable without initializing

I did a basic function of squaring (exercise of a book), and I use a variable named aux and use it to compute the square power value, but the compiler claims that aux does not is initialized, I would like to understand why and how...
asked by 14.01.2016 / 17:21
1
answer

How to make an array of objects?

How to do an array of objects? I am trying but I am not succeeding, it returns me an error:    line 26 [Error] no match for 'operator []' (operand types are 'Time'   and 'int') Code: #include <iostream> #include <cstdlib>...
asked by 29.09.2015 / 03:49
1
answer

const declaration at the end of function in C ++ and const before the argument in method

I came across this snippet of code in a material: class Foo { public: int Bar(int arg1) const //<-- qual função do const aqui? { // código a ser implementado aqui } }; [1] How does const affect this statement of method B...
asked by 09.08.2015 / 14:15
1
answer

Check whether a variable is a numeric or string

Good afternoon, Is there a function in C ++ that checks whether the variable is a string or numeric? An example: In PHP I use is_string (variable) or is_numeric (variable).     
asked by 24.08.2015 / 22:34
1
answer

C ++ class with several constructors - File header and cpp

I have a C ++ class where I have two constructors. In the minhaclasse.h file: public: MinhaClasse(int x1); MinhaClasse(int x1, int x2); Then in the minhaclasse.cpp file I usually create the builders that I declared there in the header....
asked by 25.06.2015 / 16:19
2
answers

How do I enter complex numbers in C ++?

I know I've asked a question like this before. It was about Python. But in C ++, how do you insert a complex number?     
asked by 10.05.2015 / 09:02
1
answer

Problem using the getch () function in C

I am writing a simple game that is based on traversing a number in the first element of the array to the last element. However, I want to use the getch() function so that the element moves through the array immediately after a key is ente...
asked by 17.07.2015 / 03:45
1
answer

Storing SOCKET in a vector

I am working on a project developed in c / c ++ where a server handles several connections, I do not have much experience in this language, I would like to know how to proceed to add a SOCKET to a vector, / p>     
asked by 13.05.2015 / 18:35
1
answer

When a header file is included, does the compiler include all the functions in the final program or only the functions used?

That is, is the executable going to have the whole library in it or only the functions that I use will be included by the compiler? With this, can you include many libraries that can make the program cumbersome (taking up a lot of disk space)?...
asked by 09.04.2015 / 21:11