Posts by Cleiton Santoia Silva • 132 points
9 posts
-
0
votes2
answers62
viewsA: Repeat loop in C++
In C++ has a lot of rules and coding patterns 1 - Create a structure and overwrite << and >> struct respostas : array<char, N_QUESTOES> { friend ostream&…
-
0
votes1
answer88
viewsA: "Expected Primary-Expression before 'float'", calling a function from another class
1 - Explaining vector in computation is not the same thing as vector in mathematics The first thing that is usually explained to the students of exactas, is that "vectors" in programming languages…
-
1
votes1
answer33
viewsA: Helps in allocating memory for a struct
C++ is a language other than C, in C++ : 1 - You can encapsulate the Cout << "..." and the paragraph() in a single function ( wondering which paragraph will jump to next line" )…
-
-1
votes2
answers362
viewsA: How to pass an array as argument of a function per copy?
In c++ just use Std::vector and pass as parameter : void foo(vector<int> v) { ... } // aqui v é copiado int main () { vector x = {1, 2, 3, 4, 5}; foo(x); }…
-
0
votes3
answers1489
viewsA: implementation of Split() in C++
I wrote a split() as if it were a stl algorithm in Modern C++ : template<typename it, typename valueT, typename outIt> void split(it first, it last, const valueT& e, outIt&& o) {…
-
-1
votes3
answers2499
viewsA: How to check and print repeat values in a vector
There is a "C++ way that is not C" to do some things, whenever you can use C++ prefer : 1 - Use containers stl : Std::vector instead of vectors "float vet[n]", because the allocation and…
-
0
votes2
answers185
viewsA: Fraction Sum Program (Class Overload)
I decided to make the Frac class in terms of modern C++ "" 1 - No Setter and getter for "value types" 2 - Template for algebraic types 3 - UDL to create constant values (in place of constructor) 4 -…
-
0
votes1
answer114
viewsA: How to add elements from two array lists with if C++
Hi, I advise you to always learn and use the modern C++ sub-languages: Example: corlu use Std::copy_n to read the entries copy_n(istream_iterator<int>(cin), n, std::back_inserter(v1)); // le…
-
1
votes1
answer143
viewsA: Vector comparison program C++
Hello, you can post your code on Compiler explorer that gets easier. C++ has a number of techniques to make your life easier 1 - Instead of using "[]" vectors use the "Std::vector" vector in C++ 2 -…