Questions tagged as 'c++'

1
answer

store directory

I would like to know how to add the user name where it is in quotation marks written "should I put the username here" #include "stdafx.h" #include<iostream> #include<Windows.h> #include<lmcons.h> using namespace std; int ma...
asked by 05.05.2018 / 19:11
1
answer

Declare array in class not knowing what its size will be

How to declare an array inside a class, even though it does not know how large it will be, and make it accessible throughout the program. Note this class: class exemplo{ public: int tx{0}; int ty{0}; int array[tx][ty]; // se eu tentar d...
asked by 29.05.2018 / 19:45
1
answer

Application bubble sort with random vector

Someone can help me with this code, I have to use bubble sort to order a random vector of n positions, but I can not solve the error. #include <bits/stdc++.h> using namespace std; const int n=100; int main() { int j,aux,i; //cri...
asked by 22.02.2018 / 23:05
1
answer

Passing parameter to a get method, could it cause some error in C ++?

I'm starting to study OOP now and it's kind of weird to me. But I would like to know if I pass some parameter in a get method, can it result in some error? Ex: class MostraNum { private: int x; public: int getRet...
asked by 11.04.2018 / 19:47
1
answer

Strange error in c ++ class

I have the following code: #include <iostream> using namespace std; class guns{ public: string name; int ammo; void reload(){ ammo = pente; } void shoot(){ ammo -= 1; } private: int pente = amm...
asked by 10.01.2018 / 13:37
1
answer

How do I create a sum () function for arduino? W

Angles ang = {0.0,46,0,91,2,134,7,179.2} were measured, the unit is deg (steps). I have to implement code that initializes the values as a global array, and then sets the void function sumCum (float arr []) {} which calculates cumulative sums (S...
asked by 09.01.2018 / 19:08
1
answer

error: invalid conversion from 'my_type *' to 'int' [-fpermissive]

Running my code returns this error written in the title. I do not know what to do to solve it, because if you see the code, of course the parameter type is BlockGraph and not int . When I put an integer value in place of block, no e...
asked by 01.12.2017 / 17:44
2
answers

Binary File Reading in C ++

Good morning. I'm trying to do a read of structs that I've inserted into a binary file, but it's giving error at the time of reading. Here is the code for the read function: void lerRegistros(char* file_name) { ifstream entrada;...
asked by 15.01.2018 / 18:40
1
answer

Error passing a method to another method. C ++

I'm a beginner in programming and decide to venture into a project with friends, in which I need the program to descend on the order of the routine based on one factor, I'm moving to a smaller chained list to facilitate the organization and have...
asked by 27.12.2017 / 05:28
1
answer

How do I inherit an abstract class in C ++?

In Java we have the possibility of creating abstract classes, but without the possibility to instantiate them, but we can create and instantiate a class that inherits the attributes and methods of an abstract parent. In C ++ this is done in a di...
asked by 25.11.2017 / 22:27