Questions tagged as 'c++'

3
answers

While repeat structure to recalculate in C

I solved this exercise below and thought about putting a while repetition structure, so the person recalculates. But when I put 's' to return and recalculate, the exercise sums up the values of the 10 numbers I previously calculated and a...
asked by 11.09.2015 / 23:44
2
answers

How to send and receive a file via Socket?

I need to send files via Socket in Linux C ++, as the file may have extensive content I will need to send it to pieces. In this case, I need to create a kind of protocol to send a file (in pieces) through Sockets and be able to join again on the...
asked by 05.01.2015 / 13:45
1
answer

Difference in execution time between stdio.h and iostream

I made two codes for an online judge to correct. They are essentially the same. But the stdio.h is accepted and the with the iostream does not, because it exceeds the time limit. Why does this occur? #include <stdio.h> int tipo[1000000];...
asked by 02.03.2016 / 08:51
1
answer

How to create a function equal to Array.Copy from C # in C ++

I would like to create a function similar to the Array.Copy of C # in C ++. This function has the prototype like this: public static void Copy( Array sourceArray, int sourceIndex, Array destinationArray, int destinati...
asked by 28.01.2016 / 17:47
1
answer

What are C-digraphs?

Based on the trigraphs question, what are digraphs? Why were they created? What are the sequences? Do the current compilers still allow you to use them?
asked by 18.12.2015 / 21:43
1
answer

Vector manipulation in C ++

Is there any problem if I go through a vector by taking its size with vector.size () and then make a for on the vector? I'm asking this question because almost every time I see vectors manipulation, an iterator is used to traver...
asked by 06.02.2016 / 04:39
1
answer

Is it worth using binary operators to gain performance?

I have the following situations: if (1 & 1){} and if (1 == 1){} According to what I've learned, working with bitwise operators causes a much better performance in the program, so I've had some doubts: Is performance in the f...
asked by 03.01.2018 / 22:04
1
answer

Smart Pointers

I was studying smart pointers and based on this blog: link #include <iostream> template <class T> class SmartPointer { T *ptr; public: SmartPointer(T *p):ptr(p) {} ~SmartPointer() {delete ptr;}...
asked by 03.12.2017 / 10:44
1
answer

What are the practical differences in C and C ++ code portability?

I've been reading some open-source C code lately and I've noticed that a lot of them have become quite complex with a lot of #ifdef to make the code as portable as possible between various platforms and * NIX. Some even support different...
asked by 09.10.2014 / 01:40
1
answer

Performance differences between structs and classes

I know the difference of structs and classes is that structs has its public members by default, and that structs belong to C (but nothing prevents from using in C ++). In practice when creating an object for classes or a...
asked by 20.12.2017 / 12:09