Questions tagged as 'c++'

3
answers

Different outputs in different compilers

I have this code: #include <iostream> int main(int x=1) { while (x <= 1000 && std::cout << x++ << std::endl) {} } I wrote it in Gedit, using Debian, and compiled it with Debian's own g ++, without ever changi...
asked by 18.05.2014 / 23:14
2
answers

What is the difference between memcpy and snprintf?

I'm seeing people using snprintf when I would use memcpy. I even did some testing and it worked with memcpy. Now I was in doubt why use one and not the other. And what is the real meaning of the two.     
asked by 19.06.2018 / 15:48
1
answer

How to copy an array from struct to another array?

I have 2 arrays made from a struct : struct events { string Kind; int Time; int DurVal; int Chan; }; events e1[100] events e2[100]; How can I make a full copy of array e1 to e2 in a simple command?     
asked by 16.08.2018 / 02:38
2
answers

How to read a text file and get the values as integers?

I want to know how to read a file in c ++. The first row has the size of the array and in the rest has the array elements. Each element is separated by a space, and there may be negative numbers. Rows end with \n . I did this but it has...
asked by 09.02.2014 / 16:39
1
answer

Update console without using system ("cls") in Windows

I'm creating a text game, where it will have a start menu, follow the code I already have: #include <iostream> #include <Windows.h> using namespace std; void setTamanhoConsole(int x, int y){ HANDLE console = GetStdHandle(STD_...
asked by 14.04.2016 / 19:38
1
answer

Porting Visual C ++ code to another language [closed]

Next, I have a simple ShellExecute code that was made in Visual C ++ 2012, but because it is a closed and paid platform and because I need my clients to be downloading more programs I would like this project to be ported to another language . I'...
asked by 23.11.2015 / 04:18
2
answers

How to display the "Press any key to continue" in C ++?

In C, I put the "Press any key to continue" with the getchar () command. in C ++, how do I do it?     
asked by 09.05.2015 / 21:58
2
answers

Command for combining integers. C ++

Is there a command that allows combining two integers? I have a variable that is worth 5 and one that is 6 For example, is there any command that allows you to play the combination of these variables, the value 56 , in a t...
asked by 27.07.2016 / 22:20
2
answers

Pointer operators in passing by reference

I've been studying some of the codes I found on the internet, and one of them used a prototype implementation as follows: void changeMode(Mode &m){ m.loop = true; m.quit = false; } See that the changeMode function is give...
asked by 12.06.2015 / 18:27
1
answer

How to know if three points are clockwise or not in C / C ++?

Given three points p1, p2 and p3, what is the best way to know if this order is clockwise, counterclockwise, or neither (all three are collinear)? For example, in the following image the points are clockwise: In the same case, if the...
asked by 28.04.2016 / 18:58