Questions tagged as 'c++'

2
answers

Difference of C / C ++ Array Declarations

What difference and impact do each of these 3 vector statements bring to my code? int n; cin >> n; int* arr = new int[n]; int n; cin >> n; int arr[n]; int n; cin >> n; vector <>int> arr(n);     
asked by 06.05.2017 / 19:31
1
answer

Return 0 on Linux and Windows

I'm starting the ADS course and my programming teacher insists on using return 0 at the end of the function. Most use Windows, I realized that return 0 is required in Windows but in Ubuntu (which is what I use) I do not put retu...
asked by 01.09.2017 / 04:57
3
answers

Integer for String

In QT Creator 5, how do I convert Integer to string? In Visual Studio 2012 there was the command: std::to_string(10); But it does not work on QT. I tried: #include <QCoreApplication> #include <iostream> #include <string>...
asked by 24.12.2014 / 14:26
2
answers

C ++ - Stopping condition in repetition structure

How to place this code in a repeat structure so that after the calculation the "Type S to exit or C to continue" option is shown? #include <iostream> #include <string.h> #include <locale.h> #include <stdio.h> #include &...
asked by 11.09.2015 / 10:05
1
answer

How is correct when declaring a variable that is a pointer?

I see that some people do int* variavel; And there are those who do int *variavel; Which one is correct?     
asked by 24.01.2017 / 11:41
3
answers

In structures (struct) is it necessary to use getters and setters or only in classes (class)?

Is it necessary to use setters and getters in structures to maintain good practices or is it only necessary in classes?     
asked by 13.12.2017 / 23:28
2
answers

How to capture keyboard action without pausing the C ++ program?

How do I capture a keyboard action without pausing the program? For example: char tecla; do{ scanf("%c", &tecla); printf("%c",tecla); }while(tecla != '0'); I wanted it to loop, but when typing something on the keyboard I was ab...
asked by 07.11.2014 / 17:08
1
answer

Connect and disconnect the Internet?

I would like to do two basic .exe, one would be to disconnect the Internet and open one program and the other would be to just connect to the Internet. The part of opening the program I know, now disconnect and connect the Internet in c ++ I...
asked by 27.11.2014 / 22:03
3
answers

Is the std :: map structure in C ++ a tree?

I know that every element of the structure is represented by a key and a given, but I do not see it as a tree, and I read somewhere that it is a tree.     
asked by 15.09.2016 / 22:31
2
answers

How do I pass an array as an argument to the user by setting the number of columns?

I will make a simple program just to exemplify my problem. #include<iostream> using namespace std; void recebeValor( int mat[][col]) // me da erro de comp; { mat[0][0] = 2; cout << mat[0][0]; } int main() { cout << "E...
asked by 23.11.2015 / 20:29