Questions tagged as 'c++'

1
answer

Scanf is not stopping in repetition

I have a loop while that will only end when the value 0 (zero) is entered. I have a variable that will receive a command option. Within the loop I have a switch case where: 0) exits the program (returns to while and ends);...
asked by 25.01.2016 / 13:38
3
answers

How to write data to the Windows registry?

I need to write data to the Windows registry in my application. How to work with Windows registry data manipulation using C ++? What is the correct way to write new data to the registry without errors?     
asked by 13.01.2015 / 07:34
2
answers

Resize in dynamic pointer transforms dimension into garbage

I was responding to a std :: stack implementation problem. It was easy, but I could not use my first idea: std :: vector (it replaced forever the dynamic pointers). My code is: template <class T> class stack { T* data; unsigned s...
asked by 20.04.2014 / 21:41
1
answer

Why explicitly declare the base when calling function when using templates?

I have the following code: A derived template calling a function from a base also template. template <int M> struct Base { void foo() {} }; template <int M> struct Derived : public Base<M> { void bar() { foo(); } }; B...
asked by 29.03.2014 / 12:06
1
answer

How to set a pointer as default parameter in C ++?

I'm "programming in C" but compiling using the .cpp extension and g ++ to have some facilities. My goal is to do a program that receives a starting salary and calculates the final salary according to a certain bonus. The bonus is given in...
asked by 21.08.2018 / 03:15
1
answer

How to make a screen recorder?

I'm wanting to make a screen recorder. What I thought of doing was this: From the recording event hit 30 screenshots per second and then join them in sequence to form a video. At this point some doubts arise: Is this the right way to think a...
asked by 21.10.2014 / 14:24
2
answers

Ways to instantiate an object and declare constructors

In C ++ there are several ways to create a constructor and instantiate an object. But there are so many ways I'm confused by the difference of each one. Assuming I have the following class: using namespace std; class Carro { private:...
asked by 20.09.2015 / 18:02
1
answer

Error undefined reference to std

#include <iostream> using namespace std; int main() { int nombre, carre ; cout << "Introduza un numero : " ; cin >> nombre ; carre = nombre * nombre ; cout << "A raiz quadrada est ; " << carre ; } When c...
asked by 24.02.2017 / 11:49
2
answers

If array is the same as pointer, why does one need to be copied to one variable and another need not?

In this answer bigown said that if the frame member was a pointer you do not need to copy the string into it. But arrays are not pointers? Why is it different?     
asked by 02.02.2017 / 12:35
2
answers

Doubling bit shift in C

My question is regarding the following snippet of code: #include <stdio.h> int main(void){ int teste = 0, x0 = 0, x1 = 0, x2; x2 = 1; teste = ((x0|x2) | (x1|x2) << 1); printf("Valor de teste: %d ", tes...
asked by 29.04.2017 / 01:44