Questions tagged as 'c++'

3
answers

What do these "and" operators mean? "[Duplicate]

The code below is part of an algorithm that shows the height of a binary tree: int left = height(p->left); int right= height(p->right); int larger = (left > right? left : right); return 1 + larger; What does this part (left &g...
asked by 06.12.2017 / 15:45
1
answer

Exercise URI 1012 - Wrong answer 20%

I did the exercise, almost all the outputs are coming out as the URI output is asking, however the first requirement is not as it asks in the program. I used the setprecision, but I'm not sure why the first result does not round 3 decimal places...
asked by 02.01.2018 / 22:48
1
answer

Graphics with noise in arduino no plotter

Implement code that simulates the speed of a car as a signal plus noise, with 50 elements. The speed value increases linearly from 0-50 km / h. The noise amplitude is ± 1 km / h. The values are sent to the console with a precision of three signi...
asked by 12.01.2018 / 13:17
1
answer

Is it possible to convert an array to a class / struct?

Although I have tested I'm not sure if it will always work: class Val { public: int data[4]; }; int main() { int data[4]; Val* v = reinterpret_cast<Val *>(data); }     
asked by 30.11.2017 / 15:11
1
answer

is repeating only once

Code: #include <iomanip> #include <iostream> int main() { auto time = std::time(nullptr); std::string lang_utf[6]={"pt_BR.utf8","en_US.utf8","en_GB.utf8","de_DE.utf8","ja_JP.utf8","ru_RU.utf8"}; std::string lang[6]={"pt_BR:...
asked by 16.10.2017 / 22:17
1
answer

Draw between user-defined options

Hello, I am creating a Petri Net simulator (I considered it a challenge since I am a beginner) and would like to know if there is a way to create a raffle between user-defined options. I would like to sort between, for example, 0, 2, 3 and 5 (th...
asked by 01.10.2017 / 05:26
1
answer

how to compile c ++ classes in the makefile?

I was doing a program in c ++ (usually used an IDE to compile and everything), but this time I needed to do it without an IDE, so when I did the makefile to compile the program, it gave an error with something related to the class constructor...
asked by 24.09.2017 / 07:20
1
answer

C ++ program error: "[Error] expected primary-expression before 'F1'"

Hello, good evening everyone! I have a problem with my number occurrence function in the vector. The error:    [Error] expected primary-expression before 'F1' Could anyone help me solve this problem? Thanks in advance! #include <s...
asked by 09.10.2017 / 02:45
1
answer

How do I create a variable of type char with an indeterminate size [duplicate]

How do I create a variable of type char * (to store a name) with an indeterminate size? Example: char nome[30] = { 0 } // 30 é o valor máximo e no caso se a pessoa tiver um nome grande? que ultrapasse 30? cout << "Informe seu nome c...
asked by 15.10.2017 / 14:37
1
answer

Problem when printing c ++ array

I'm trying to read an array and print it completely, but only the last line is coming out and I do not know why. #include "matriz.hpp" #include <iostream> Matriz::Matriz(){ char matriz[0][0]; int quantidade_linhas=0 ; int quantida...
asked by 06.09.2017 / 04:31