|
Additional to the links from the previous posters....
Rule of thumb: Use references when ever possible, pointers when necessary.
|
|
|
|
|
Hi All,
I am using the function unbuffered(int) in my project in VC 6.0 but when i compiled in .Net it is showing error saying that it is an undeclared identifier. This was inlcuded in the header Streamb.h in VC6.
But I couldn't find the header in VC++.Net. May I know whether this function has been taken out in .Net or is there any equallent function for the same?
thanks and regards,
Rajesh
|
|
|
|
|
Hi all
I have an assignment where I have to implement the abstract data type (ADT) Set which defines a set.
The following applies to sets:
• There must only be one occurrence of each element in the set (no duplicates allowed)
• The elements in the set are not ordered (they are not in a particular order)
• The union of two sets A and B (A U B) results in a new set containing the same elements as in A and also the element that are in B, but no duplicates.
• The difference between two sets A and B (A - B) results in a new set containing the elements that are in A but not on B.
•The intersection of the sets A and B produces a new set which contains all the elements that are equal in sets A and B.
The set is described by:
template <class t="">;
class Set
{
private:
class Node
{
public:
T data;
Node *next;
Node(T data) { this->;data = data; this->;next = NULL;}
~Node(){}
};
Node *first;
int nrOfNodes;
public:
Set();
Set(const Set<t>& set);
virtual ~Set();
void insert(T item);
T remove(T item); // returnerar det element som tas bort
bool isMember(const T& item) const;
int size() const;
Set<t> operator=(const Set<t>& set);
Set<t> operator+(const Set<t>& set) const; // union
Set<t> operator-(const Set<t>& set) const; // differense
Set<t> operator*(const Set<t>& set) const; // snitt
};
The storage structure for the set is a single-linked circular list (the next-pointer of the last element points at the first element).
I have created some empty functions for far for easy compiling,
//search
template <class t="">
bool Set<t>::isMember(const T& item) const
{
// return index if found or -1 if not found
Node* p;
int count = 0;
for (p = front; p != NULL; p = p->link)
{
if (p->data == item)
{
return true;
}
count++;
}
return false;
}
//add
template <class t="">
void Set<t>::insert(T item)
{
}
//remove
template <class t="">
T Set<t>::remove(T item)
{
}
//Display
template <class t="">
void Set<t>::display()
{
Node *q;
for( q = first ; q != NULL ; q = q->next )
cout<<q->data<<", ";
}
void main()
{
Set<int> SetA(10), SetB(10);
Set mySet(SetA);
}
When I compiled I get the following errors
cannot convert parameter 1 from 'int' to 'const Set<T> &'
with
[
T=int
]
Reason: cannot convert from 'int' to 'const Set<T>'
with
[
T=int
]
No constructor could take the source type, or constructor overload resolution was ambiguous
d:\visualprogrammes\linkedlist\linkedlist\linked_list.cpp(73) : error C2514: 'Set' : class has no constructors
d:\visualprogrammes\linkedlist\linkedlist\linked_list.cpp(6) : see declaration of 'Set'
Can someone please help, I can't see why the code in the main can't compile.
Thank you!
|
|
|
|
|
You'll have to define a parameterized constructor (that takes int parameter) for the class Set. And I wonder what you're trying to achieve by passing int parameter to Set class i.e. are you passing the size (10 items) or data (element) for the set. You'll have to code the parameterized constructor according the functionality required.
- Malli...!
|
|
|
|
|
Thanks Malli,
Can you please help to give some examples, if I want to pass dat (element)? I have no idea how to do it. Thanks.
|
|
|
|
|
you can refer STL implementation of set, [STL::Set class^] it is defined in <set> header file.
|
|
|
|
|
Hello friends!
Can anybody suggest me how we r going to design this system.As i have no idea regarding it.......Need initiative ....Actually where should we start
Thanx !
|
|
|
|
|
|
Hi all,
i m Using SDI type application in VC++2005.
in Dialog box i m using a ListCtrl and other controls like EditBox,TextCtrl,ComboBox.
i want if i click on ListCtrl than the relevant information show in other controls.
how can i do this please help me for this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I would add a handler for the click event of the list control, and add control variables for other controls of my interest and do the updating. Where are you stuck?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
can u please tell me with example.
i m using the click event of List control. but i dont know how can show the value at this time in other controls.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
For example, if you would like to update an edit control, add a control variable to it (CEdit type) and name it, say c_edit . In the click event handler of your list control, update the value of your edit control using the control variable c_edit.SetWindowText() .
Here[^] is an example, which demonstrates how to use the CEdit control. You may have to add control variables for other controls and update them as well.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Thanks sir.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
You're welcome sir.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I dont know did you read any book about VC++ or no but anyway if you want to make each event for your controls you can double click on that control or use of Control Events at property window of control.
|
|
|
|
|
ThatsMe. wrote:
in Dialog box i m using a ListCtrl and other controls like EditBox,TextCtrl,ComboBox.
i want if i click on ListCtrl than the relevant information show in other controls.
Handle the LBN_SELCHANGE notification from your ListCtrl.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi,
How can I get the windows Icon e.g. desktop icon, folder icon, my sharing folder icon etc.
|
|
|
|
|
|
Hi All,
Is there any API by which I could enable/disable the wireless adapter?
Thank you,
AJ
|
|
|
|
|
You can use WMI to do it. You can also make a call to DevCon[^], but DevCon is not redistributable.
|
|
|
|
|
Hi,
I am developing an installation tool with WIX programming.
I got an error Error CNDL0129: Schema validation failed with the following error: The element `Product` in namespace `http//schema.microsoft.com/wix/2003/01/wi` cannot contain text.
I couldn't find any reference for the above error.
Could you please give the solution.
Thanks in advance.
Regards,
Vijay
Help Ever Hurt Never
|
|
|
|
|
Hi all,
in property sheet i m using diffrent property pages so please tell me how can i move on next property page with the help of keyboard.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Press tab until the focus reaches on the title of property sheet, then use arrow keys to move to next page.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Using Ctrl + Tab You can navidate between the property pages.
|
|
|
|
|
Superb!
My 5 vote.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|