Questions tagged as 'c++'

1
answer

Switch entering the wrong case

I'm trying to solve the problem of Uri 1038 using switch , apparently the values are mixing, Item 3 for example multiplying by 2 (5 x 2) returns the value 3. What am I doing wrong here ? #include "pch.h" #include <iostream> using...
asked by 16.08.2018 / 19:30
2
answers

Compiling doubt in C / C ++

I started to study about compilation of multiple files and I had a question. When we create a new header, we have to create another file with the implementation of the prototypes contained in the header, create the object and compile everything...
asked by 08.06.2015 / 17:23
3
answers

Count characters without empty spaces

I have to count the number of characters in a string, but when empty, it counts as a character. How do I remove these gaps? Any tips?     
asked by 28.03.2014 / 17:20
2
answers

How to instantiate objects in shared memory?

I have an application in which there are several modes of parallelization. However, when I am going to parallelize through fork () the barrier is not shared between the processes, is there any difference of Shm in dealing with instantiation via...
asked by 20.11.2018 / 13:33
1
answer

C ++ std :: string.c_str () always returning NULL

Recently I made a question, why istreambuf_iterator does not work in android NDK , as I had no answer I decided to find out myself, I created a project in Visual Studio 2017, simple thing, just to read a file in binary mode and show the result...
asked by 02.04.2018 / 16:12
1
answer

When to allocate memory dynamically?

In C ++ you can easily declare an object or variable like this: tipo_da_variável nome_da_variável; This type of declaration is the easiest to use, but you can also use new to allocate memory dynamically and then deallocate with delet...
asked by 17.04.2018 / 16:41
1
answer

lvalue required as left operand of assignment - remainder of division

I have a problem making the rest of the room. You gave this error:    value required as left operand of assignment How do I resolve this? #include <stdio.h> #include <stdlib.h> int main() { int x; printf("informe o numero i...
asked by 02.04.2018 / 20:15
1
answer

Function with variable number of parameters via template

I know that the templates in function definitions makes, for each configuration that it allows, to compile a different function. I want to know if it is possible to create functions with a varied number of parameters in such a way that it com...
asked by 03.08.2017 / 22:29
1
answer

Libraries and Preprocessing in C / C ++

I've always been surprised at the syntax of #include and #define , since they differ greatly from the syntax of the rest of the language. I have found that this is due to the fact that these commands are intended for the preprocesso...
asked by 19.02.2018 / 03:05
1
answer

What is the problem with my program?

I'm trying to better understand how pointers work in C and C ++ and for this I am trying to make this small list of linked lists (I took the example from the book "Data Structures" of the publisher Cengage Learning). I can not understand why my...
asked by 04.08.2016 / 07:30