Questions tagged as 'c++'

1
answer

How to create an object with class template?

I have this code: Main.cpp Warehouse<Base<int>> arm(1, 1, 1, 1); arm.createSubBase(1,1,1); Warehouse.h private: vector<Base<T>*> whouse; public : void createSubBase(int, int, int); template <class T> v...
asked by 25.10.2014 / 16:48
1
answer

Error in lexar a mathematical equation

I am doing an equation interpreter in C ++ and am trying to show the type of the symbol. But I'm in trouble. I do not know what's wrong. Any constructive tip is welcome. main.cpp : #include <string> #include <iostream>...
asked by 19.06.2018 / 23:01
1
answer

Array bug in size 4

I'm asking you the following question: So I did this algorithm: #include <stdio.h> #include <stdlib.h> int main() { int i, j, x=0; int vetor[x]; printf ("Digite o tamanho do vetor:\n"); scanf ("%d", &x); for (i=...
asked by 12.05.2018 / 23:51
1
answer

How to get the same result of strcpy () with strcpy_s ()?

I downloaded a code in C ++ from the internet and when I open the solution, it gives the following error:    Error C4996 'strcpy': This function or variable may be unsafe. Consider   using strcpy_s instead. To disable deprecation, use   _CRT_...
asked by 20.07.2017 / 19:28
1
answer

std :: sort with comparison function

Studying a little about STL I came across the std::sort function that can receive a comparison function. template< class RandomIt, class Compare > void sort( RandomIt first, RandomIt last, Compare comp ); How does this comparis...
asked by 21.04.2017 / 00:15
1
answer

Doubts about simple chaining in c

I wanted to know why the removal processes in threads have two pointers set to the next As this example given void remove (celula *p) { celula *lixo; lixo = p->prox; p->prox = lixo->prox; free (lixo); } Because there's always s...
asked by 18.04.2017 / 21:44
1
answer

Print vector disregarding repeated values

   Make an algorithm that reads a vector of 50 elements and prints the vector   disregarding the repeated values. The code is giving the correct output, but if I type a repeated number, the program asks for a new one until I enter one that d...
asked by 15.10.2014 / 17:38
1
answer

How is a struct organized in memory?

How does access to struct work? Can I put the members in the order I want? How does the compiler know which part of memory it should access? How would this look? struct { char ch1; short s; char ch2; long long ll; int i;...
asked by 10.02.2017 / 13:37
2
answers

Interest calculation

   [Engelbrecht et al., 2012] Develop a program that receives from the user, the value of an application and the value of the initial interest rate. Considering that this interest rate increases by 0.025% per month, then store in vectors with 12...
asked by 30.11.2017 / 22:04
1
answer

How do I draw a line in the "Cin" of the iostream library?

How can I remove the line break when reading some variable with cin ? #include <iostream> using namespace std; int main() { int dia, mes, ano; cout<< "Data: "; cin>> dia;cout<<"/"; cin>> mes;co...
asked by 06.01.2018 / 04:09