I have the following question, for example:
int a = 5;
int b = 10;
int & r = a;
How do I make the reference variable r point to b and not more to a ? Is it possible to do this?
I'm developing a program in C that randomly generates a thousand numbers and that in the end appears the largest and smallest of them. For this, I'm using rand() .
But I have a problem. When I run only less than 300 numbers are generate...
I'm new to C ++ and would like to know how to use complex numbers without being as follows:
double real[2]={2,5};
double imaginario[2]{7,9};
cout << "Soma: " << real[0]+real[1] << "+" << imaginario[0]+imaginario[1] &l...
In c ++ is it possible to execute expressions within a variable?
Ex (in Moon):
n = math.random(9, 10)
a = n .. (#tostring(n) > 9 and "-" or "--")
print(a)
If n were equal to 9 would return:
9--
If not, I would return
10-
In c +...
I wanted to put the columns closer so that they do not happen as in figure 2.
int i,j,elemento;
for(i=0; i<elemento; i++){
for(j=-elemento; j<=elemento; j++){
if(i >= abs(j)) {
cout<<"\t"<<abs(j)+1...
What can happen if I return a local variable? I read on the internet that it is not a good idea to return a local variable.
Maybe because the variable when exiting the function is deleted?
Example:
std::string StrLower(std::string str)
{...
I see in many codes some variables with the suffix _t . There are a lot of examples in the default C library as size_t , int32_t , mbstate_t .
How useful, and when to use this suffix?
I have searched the internet for a way to build graphical interfaces for windows without necessarily using the Windows API.
I program in C # and for that, I have the WPF solution. However, I could not find any solution in C ++.
My goal is...
I clearly understand what a Garbage Collector is and what a Garbage Collector is for. It is very well known in Java.
Is there a library in C ++ that implements GC or fixes memory lLeaks?
I have already searched the internet but it always...