c++ conversion const member [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a member L that is a list of pairs of ints which I would like to use in a const function. I'm hence not supposed to modify L, but I don't know how I can iterate through L, to read its contents (as opposed to modifying them).
The compiler keeps saying there is a conversion issue.

Assuming you are using std::list<std::pair<int,int>> you need to use std::list<std::pair<int,int>>::const_iterator as the type for your iterator.

Related

Why does Qt use arrow syntax? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Is there a reason why Qt decided to replace the . with ->? Is there a technical reason why we do:
ui->statusBar->setSizeGripEnabled(false);
instead of
ui.statusBar.setSizeGripEnabled(false);
?
This isn't a choice of Qt, but the way proper design in C++ works. -> dereferences a pointer to an object to access a member of it. Passing a pointer around tends to be the cleanest method of access to an object.

What is the boolean data type in C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm doing some exercise where I need to use a boolean. However when I try to create one as Boolean the compiler does not accept it. What is the name of the boolean type in C++?
The boolean datatype in C++ is bool as in:
bool myBool = true;

C++ Program Required with arrays [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I want to write a program which will show the numeric value of odd, even & zero values in array. The problem is that when I input values in array, C++ compiler doesn’t view the result and finishes the output window . Is there any solution for this?
Assuming you mean why the console window closes, you can add cin.get() to the end.

about pointer and reference [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a pointer *p and a reference &s. I would like all the values that s contains to be copied by p. How can I do this?
Need some code example. THX
Your question is a lot less than clear. But for now, I'll give you this:
*p = s;
If this doesn't answer your question, then you need to clarify exactly what you're after.

validating the value in a integer...? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
how do v find a value in an integer is garbage or not???
Initialize it at point of declaration, and it can never be garbage.
Pass it to strfry and compare the returned value with the original.
I guess that you mean if a string contains a valid integer. Check out scanf or the stream equivalent of c++, or Boost lexical cast