Error in c++ program

Reply

Join Date: Oct 2004
Posts: 3
Reputation: Midnight Skulke is an unknown quantity at this point 
Solved Threads: 0
Midnight Skulke Midnight Skulke is offline Offline
Newbie Poster

Error in c++ program

 
0
  #1
Oct 24th, 2004
I have design two program and both have errors on it. the first is supposed to handle queue on integer, double, string and date. I have done for integer and double. When I compile it there was error on it. If you can just help me debug it and i will complete the string and date myself. i have to submit this by Thursday. below is the code for it:

  1. //listnd.h
  2. //ListNode template definition
  3. #ifndef LISTND_H
  4. #define LISTND_H
  5.  
  6. template< class NODETYPE > class List; //forward declaration
  7.  
  8. template<class NODETYPE>
  9. class ListNode {
  10. friend class List< NODETYPE >; //make List a friend
  11. public:
  12. ListNode( const NODETYPE & ); //constructor
  13. NODETYPE getData() const; //return data in the node
  14. private:
  15. NODETYPE data; //data
  16. ListNode< NODETYPE > *nextPtr; //next node in the list
  17. };
  18.  
  19. //Constructor
  20. template<class NODETYPE>
  21. ListNode< NODETYPE >::ListNode( const NODETYPE &info )
  22. : data( info ), nextPtr( 0 ) { }
  23.  
  24. //Return a copy of the data in the node
  25. template< class NODETYPE >
  26. NODETYPE ListNode< NODETYPE >::getData() const { return data; }
  27.  
  28. #endif
  29. //-------------------------------------------------------------------------
  30.  
  31. #ifndef LIST_H
  32. #define LIST_H
  33.  
  34. #include <iostream>
  35. #include <cassert>
  36. #include "listnd.h"
  37.  
  38. using std::cout;
  39.  
  40. template< class NODETYPE >
  41. class List {
  42. public:
  43. List(); //constructor
  44. ~List(); //destructor
  45. void insertAtFront( const NODETYPE & );
  46. void insertAtBack( const NODETYPE & );
  47. bool removeFromFront( NODETYPE & );
  48. bool removeFromBack( NODETYPE & );
  49. bool isEmpty() const;
  50. void print() const;
  51. private:
  52. ListNode< NODETYPE > *firstPtr; //pointer to first node
  53. ListNode< NODETYPE > *lastPtr; //pointer to last node
  54.  
  55. //Utility function to allocate a new node
  56. ListNode< NODETYPE > *getNewNode( const NODETYPE & );
  57. };
  58.  
  59. //Default constructor
  60. template< class NODETYPE >
  61. List< NODETYPE >::List() : firstPtr( 0 ), lastPtr( 0 ) { }
  62. //Destructor
  63. template< class NODETYPE >
  64. List< NODETYPE >::~List()
  65. {
  66. if( !isEmpty() ) { //List is not empty
  67. cout << "Destroying nodes...\n";
  68.  
  69. ListNode< NODETYPE > *currentPtr = firstPtr, *tempPtr;
  70.  
  71. while ( currentPtr != 0 ) { //delete remaining nodes
  72. tempPtr = currentPtr;
  73. cout << tempPtr->data << '\n';
  74. currentPtr = currentPtr->nextPtr;
  75. delete tempPtr;
  76. }
  77. }
  78.  
  79. cout << "All nodes destroyed\n\n";
  80. }
  81.  
  82. //Insert a node at the front of the list
  83. template< class NODETYPE >
  84. void List< NODETYPE>::insertAtFront( const NODETYPE &value )
  85. {
  86. ListNode< NODETYPE > *newPtr = getNewNode( value );
  87.  
  88. if ( isEmpty() ) //List is empty
  89. firstPtr = lastPtr = newPtr;
  90. else { //List is not empty
  91. newPtr->nextPtr = firstPtr;
  92. firstPtr = newPtr;
  93. }
  94. }
  95.  
  96. //Insert a node at the back of the list
  97. template< class NODETYPE >
  98. void List< NODETYPE >::insertAtBack( const NODETYPE &value )
  99. {
  100. ListNode< NODETYPE > *newPtr = getNewNode( value );
  101.  
  102. if (isEmpty() ) //List is empty
  103. firstPtr = lastPtr = newPtr;
  104. else { //List is not empty
  105. lastPtr->nextPtr = newPtr;
  106. lastPtr = newPtr;
  107. }
  108. }
  109.  
  110. //Delete a node from the front of the list
  111. template< class NODETYPE >
  112. bool List< NODETYPE >::removeFromFront( NODETYPE &value )
  113. {
  114. if ( isEmpty() ) //List is empty
  115. return return; //delete unsuccessful
  116. else {
  117. ListNode< NODETYPE > *tempPtr = firstPtr;
  118.  
  119. if ( firstPtr == lastPtr )
  120. firstPtr = lastPtr = 0;
  121. else
  122. firstPtr = firstPtr->nextPtr;
  123.  
  124. value = tempPtr->data; //data being removed
  125. delete tempPtr;
  126. return; //delete successful
  127. }
  128. }
  129.  
  130. //Delete a node from the back of the list
  131. template< class NODETYPE >
  132. bool List< NODETYPE >::removeFromBack( NODETYPE &value )
  133. {
  134. if ( isEmpty() )
  135. return return; //delete succesful
  136. else {
  137. ListNode< NODETYPE > *tempPtr = lastPtr;
  138.  
  139. if ( firstPtr == lastPtr )
  140. firstPtr = LastPtr = 0;
  141. else {
  142. ListNode< NODETYPE > *currentPtr = firstPtr;
  143.  
  144. while ( currentPtr->nextPtr != lastPtr )
  145. currentPtr = currentPtr->nextPtr;
  146.  
  147. lastPtr = currentPtr;
  148. currentPtr->nextPtr = 0;
  149. }
  150.  
  151. value = tempPtr->data;
  152. delete tempPtr;
  153. return return; //delete succesful
  154. }
  155. }
  156.  
  157. //Is the List empty
  158. template< class NODETYPE >
  159. bool List< NODETYPE >::isEmpty() const
  160. { return firstPtr ==0; }
  161.  
  162. //return a pointer to a newly allocated node
  163. template < class NODETYPE >
  164. ListNode< NODETYPE > *List< NODETYPE >::getNewNode(
  165. const NODETYPE &value )
  166. {
  167. ListNode< NODETYPE > *ptr =
  168. new ListNode< NODETYPE >( value );
  169. assert( ptr != 0 );
  170. return ptr;
  171. }
  172.  
  173. //Display the contents of the List
  174. template< class NODETYPE >
  175. void List< NODETYPE >::print() const
  176. {
  177. if ( isEmpty() ) {
  178. cout << "The list is empty\n\n";
  179. return;
  180. }
  181.  
  182. ListNode< NODETYPE > *currentPtr = firstPtr;
  183.  
  184. cout << "The list is: ";
  185.  
  186. while ( currentPtr != 0 ) {
  187. cout << currentPtr->data << ' ';
  188. currentPtr = currentPtr->nextPtr;
  189. }
  190.  
  191. cout << "\n\n";
  192.  
  193. }
  194.  
  195. #endif
  196. //-------------------------------------------------------------------------
  197.  
  198.  
  199. #ifndef QUEUE_H
  200. #define QUEUE_H
  201.  
  202. #include "list.h"
  203.  
  204. template< class QUEUETYPE >
  205. class Queue: private List< QUEUETYPE > {
  206. public:
  207. void enqueue( const QUEUETYPE &d ) { insertAtBack( d ); }
  208. bool dequeue( QUEUETYPE &d )
  209. { return removeFromFront( d ); }
  210. bool isQueueEmpty() const { return isEmpty(); }
  211. void printQueue() const { print(); }
  212. };
  213.  
  214. #endif
  215. //-------------------------------------------------------------------------
  216.  
  217.  
  218. #include <iostream>
  219. #include "queue.h"
  220.  
  221. using std::endl;
  222.  
  223. int main()
  224. {
  225. Queue< int > intQueue;
  226. int dequeueInteger, i;
  227. cout << "processing an integer Queue" << endl;
  228.  
  229. for ( i = 0; i < 4; i++ ) {
  230. intQueue.enqueue( i );
  231. intQueue.printQueue();
  232. }
  233.  
  234. while ( !intQueue.isQueueEmpty() ) {
  235. intQueue.dequeue( dequeueInteger );
  236. cout << dequeueInteger << " dequeued" << endl;
  237. intQueue.printQueue();
  238. }
  239.  
  240. Queue< double > doubleQueue;
  241. double val = 1.1, dequeueDouble;
  242.  
  243. cout << "processing a double Queue" << endl;
  244.  
  245. for ( i = 0; i < 4; i++ ) {
  246. doubleQueue.enqueue( val );
  247. doubleQueue.printQueue();
  248. val += 1.1;
  249. }
  250.  
  251. while ( !doubleQueue.isQueueEmpty() ) {
  252. doubleQueue.dequeue( dequeueDouble );
  253. cout << dequeueDouble << " dequeued" << endl;
  254. doubleQueue.printQueue();
  255. }
  256.  
  257. return 0;
  258. }
  259.  
  260.  
  261. The second problem is a program that is supposed to do a quicksort on a set of array type double and later do a bsearch. I actually modified the actual program into a class file. I'm actually weak at class and i hope you can help me. Below is the code:
  262.  
  263. #include <iostream.h>
  264. #include <algorithm>
  265.  
  266. //class quicksort
  267.  
  268. class qsort
  269. {
  270. public:
  271. int compare(const void*, const void*);
  272. //qsort (list, 10, sizeof(int), compare); //error
  273. public:
  274. int list;
  275. int element;
  276.  
  277. };
  278.  
  279. //class bsearch
  280.  
  281. class bsearch
  282. {
  283. public:
  284. int compare(const void*, const void*);
  285.  
  286. public:
  287. double list;
  288. int element;
  289. double key;
  290.  
  291. };
  292.  
  293. int main()
  294. {
  295.  
  296. double list[10] = {9.2,5.1,2.6,8.5,1.7,7.1,3.2,6.3,4.6,0.1};
  297. double key = 3;
  298.  
  299. //display unsorted list
  300.  
  301. for (int element = 0; element <= 9; element++)
  302. {
  303. cout << list[element] << " ";
  304. }
  305.  
  306. cout << endl;
  307. qsort (list, 10, sizeof(int), compare); //error
  308.  
  309. //display sorted list
  310.  
  311. for (element = 0; element <= 9; element++)
  312. {
  313. cout << list[element] << " ";
  314. }
  315.  
  316. //displays whether the number in the array or not
  317.  
  318. /*if (bsearch(&key,list,10,sizeof(int),compare)) //error
  319. {
  320. cout<<key<<" is in the array"<<endl; //number in array
  321. }
  322. else
  323. {
  324. cout << key <<" is NOT in the array2" <<endl; //number not in array
  325. }*/
  326.  
  327. return 0;
  328.  
  329. }
  330.  
  331. int compare1(const void* a_PTR, const void* b_PTR)
  332. {
  333. return *((int*)a_PTR) - *((int*)b_PTR);
  334. }
  335.  
Thank you for your help.
Last edited by alc6379; Oct 26th, 2004 at 12:17 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,539
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Error in c++ program. urgent

 
0
  #2
Oct 24th, 2004
>If you can just help me debug it
I'll help, but I'm not going to do it for you. Debugging is what the majority of programming is, so if I did it for you then you would learn nothing. As it is, you didn't specify what the error was in the first program, and I have better things to do than figure out what you think is wrong with it then tell you so that you can claim m4d debugging sk1llz. :rolleyes:

>qsort (list, 10, sizeof(int), compare); //error
You can't call a function in a class definition.

>if (bsearch(&key,list,10,sizeof(int),compare)) //error
Is the error "Unrecognized function" or something similar? Tell us what the errors are! And include <cstdlib> because that's where qsort and bsearch are declared.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3
Reputation: Midnight Skulke is an unknown quantity at this point 
Solved Threads: 0
Midnight Skulke Midnight Skulke is offline Offline
Newbie Poster

Re: Error in c++ program. urgent

 
0
  #3
Oct 25th, 2004
For the first problem that is about queues. I have debug it and when I compile the program there is no error or warning but when i build it it says 3 errors. Below is the modified code and the errors
Code:

  1. //listnd.h
  2. //ListNode template definition
  3.  
  4. #ifndef LISTND_H
  5. #define LISTND_H
  6.  
  7. template< class NODETYPE > class List; // forward declaration
  8.  
  9. template<class NODETYPE>
  10. class ListNode {
  11. friend class List< NODETYPE >; // make List a friend
  12. public:
  13. ListNode( const NODETYPE & ); // constructor
  14. NODETYPE getData() const; // return data in the node
  15. private:
  16. NODETYPE data; // data
  17. ListNode< NODETYPE > *nextPtr; // next node in the list
  18. };
  19.  
  20. // Constructor
  21. template<class NODETYPE>
  22. ListNode< NODETYPE >::ListNode( const NODETYPE &info )
  23. : data( info ), nextPtr( 0 ) { }
  24.  
  25. // Return a copy of the data in the node
  26. template< class NODETYPE >
  27. NODETYPE ListNode< NODETYPE >::getData() const { return data; }
  28.  
  29. #endif
  30.  
  31. // list.h
  32. // Template List class definition
  33.  
  34. #ifndef LIST_H
  35. #define LIST_H
  36.  
  37. #include <iostream>
  38. #include <cassert>
  39. #include "listnd.h"
  40.  
  41. using std::cout;
  42.  
  43. template< class NODETYPE >
  44. class List {
  45. public:
  46. List(); // constructor
  47. ~List(); // destructor
  48. void insertAtFront( const NODETYPE & );
  49. void insertAtBack( const NODETYPE & );
  50. bool removeFromFront( NODETYPE & );
  51. bool removeFromBack ( NODETYPE & );
  52. bool isEmpty() const;
  53. void print() const;
  54. private:
  55. ListNode< NODETYPE > *firstPtr; // pointer to first node
  56. ListNode< NODETYPE > *lastPtr; // pointer to last node
  57.  
  58. // Utility function to allocate a new node
  59. ListNode< NODETYPE > *getNewNode( const NODETYPE & );
  60. };
  61.  
  62. // Default constructor
  63. template< class NODETYPE >
  64. List< NODETYPE >::List() : firstPtr( 0 ), lastPtr( 0 ) { }
  65.  
  66. // Destructor
  67. template< class NODETYPE >
  68. List< NODETYPE >::~List()
  69. {
  70. if ( !isEmpty() ) { // List is not empty
  71. cout << "Destroying nodes...\n";
  72.  
  73. ListNode< NODETYPE > *currentPtr = firstPtr, *tempPtr;
  74.  
  75. while ( currentPtr != 0 ) { // delete remaining nodes
  76. tempPtr = currentPtr;
  77. cout << tempPtr->data << '\n';
  78. currentPtr = currentPtr->nextPtr;
  79. delete tempPtr;
  80. }
  81. }
  82.  
  83. cout << "All nodes destroyed\n\n";
  84. }
  85.  
  86. // Insert a node at the front of the list
  87. template< class NODETYPE >
  88. void List< NODETYPE >::insertAtFront( const NODETYPE &value )
  89. {
  90. ListNode< NODETYPE > *newPtr = getNewNode( value );
  91.  
  92. if ( isEmpty() ) // List is empty
  93. firstPtr = lastPtr = newPtr;
  94. else {
  95. newPtr->nextPtr = firstPtr;
  96. firstPtr = newPtr;
  97. }
  98. }
  99.  
  100. // Insert a node at the back of the list
  101. template< class NODETYPE >
  102. void List< NODETYPE >::insertAtBack( const NODETYPE &value )
  103. {
  104. ListNode< NODETYPE > *newPtr = getNewNode( value );
  105.  
  106. if ( isEmpty() ) // List is empty
  107. firstPtr = lastPtr = newPtr;
  108. else {
  109. lastPtr->nextPtr = newPtr;
  110. lastPtr = newPtr;
  111. }
  112. }
  113.  
  114. // Delete a node from the front of the list
  115. template< class NODETYPE >
  116. bool List< NODETYPE >::removeFromBack( NODETYPE &value )
  117. {
  118. if ( isEmpty() )
  119. return return; // delete unsuccessful
  120. else {
  121. ListNode< NODETYPE > *tempPtr = lastPtr;
  122.  
  123. if ( firstPtr == lastPtr )
  124. firstPtr = lastPtr = 0;
  125. else {
  126. ListNode< NODETYPE > *currentPtr = firstPtr;
  127.  
  128. while ( currentPtr->nextPtr != lastPtr )
  129. currentPtr = currentPtr->nextPtr;
  130.  
  131. lastPtr = currentPtr;
  132. currentPtr->nextPtr = 0;
  133. }
  134.  
  135. value = tempPtr->data;
  136. delete tempPtr;
  137. return return; // delete successful
  138. }
  139. }
  140.  
  141. // Is the List empty?
  142. template< class NODETYPE >
  143. bool List< NODETYPE >::isEmpty() const
  144. { return firstPtr == 0; }
  145.  
  146. // return a pointer to a newly allocated node
  147. template< class NODETYPE >
  148. ListNode< NODETYPE > *List< NODETYPE >::getNewNode( const NODETYPE &value )
  149. {
  150. ListNode< NODETYPE > *ptr = new ListNode< NODETYPE >( value );
  151. assert( ptr != 0 );
  152. return ptr;
  153. }
  154.  
  155. // Display the contents of the List
  156. template< class NODETYPE >
  157. void List< NODETYPE >::print() const
  158. {
  159. if ( isEmpty() ) {
  160. cout << "The list si empty\n\n";
  161. return;
  162. }
  163.  
  164. ListNode< NODETYPE > *currentPtr = firstPtr;
  165.  
  166. cout << "The list is: ";
  167.  
  168. while ( currentPtr != 0 ) {
  169. cout << currentPtr->data << ' ';
  170. currentPtr = currentPtr->nextPtr;
  171. }
  172.  
  173. cout << "\n\n";
  174. }
  175.  
  176. #endif
  177.  
  178. // queue.h
  179. // Queue class template definition
  180. // Derived from class List
  181. #ifndef QUEUE_H
  182. #define QUEUE_H
  183.  
  184. #include "list.h"
  185.  
  186. template< class QUEUETYPE >
  187. class Queue: private List< QUEUETYPE > {
  188. public:
  189. void enqueue( const QUEUETYPE &d ) { insertAtBack( d ); }
  190. bool dequeue( QUEUETYPE &d )
  191. { return removeFromFront( d ); }
  192. bool isQueueEmpty() const { return isEmpty(); }
  193. void printQueue() const { print(); }
  194. };
  195.  
  196. #endif
  197.  
  198.  
  199. #include <iostream>
  200. #include "queue.h"
  201.  
  202. using std::endl;
  203.  
  204. int main()
  205. {
  206. Queue< int > intQueue;
  207. int dequeueInteger, i;
  208. cout << "processing an integer Queue" << endl;
  209.  
  210. for ( i = 0; i < 4; i++ ) {
  211. intQueue.enqueue( i );
  212. intQueue.printQueue();
  213. }
  214.  
  215. while ( !intQueue.isQueueEmpty() ) {
  216. intQueue.dequeue( dequeueInteger );
  217. cout << dequeueInteger << " dequeued" << endl;
  218. intQueue.printQueue();
  219. }
  220.  
  221. Queue< double > doubleQueue;
  222. double val = 1.1, dequeueDouble;
  223.  
  224. cout << "processing a double Queue" << endl;
  225.  
  226. for ( i = 0; i < 4; i++ ) {
  227. doubleQueue.enqueue( val );
  228. doubleQueue.printQueue();
  229. val += 1.1;
  230. }
  231.  
  232. while ( !doubleQueue.isQueueEmpty() ) {
  233. doubleQueue.dequeue( dequeueDouble );
  234. cout << dequeueDouble << " dequeued" << endl;
  235. doubleQueue.printQueue();
  236. }
  237.  
  238. return 0;
  239. }

Error:

1. T2.OBJ : error LNK2001: unresolved external symbol "public: bool __thiscall List<int>::removeFromFront(int &)" (?removeFromFront@?$List@H@@QAE_NAAH@Z)

2. T2.OBJ : error LNK2001: unresolved external symbol "public: bool __thiscall List<double>::removeFromFront(double &)" (?removeFromFront@?$List@N@@QAE_NAAN@Z)

3. Debug/T2.exe : fatal error LNK1120: 2 unresolved externals

Honestly speaking i don't have a clue what this means. I tried going through the whole program again and again. Checking through to see what the problem and i can't find it. ( note: T2 is the name of the program. T2.cpp ). Anyone can explain to me on how to handle this? :mad:
Last edited by alc6379; Oct 26th, 2004 at 12:17 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,539
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Error in c++ program. urgent

 
0
  #4
Oct 26th, 2004
>Honestly speaking i don't have a clue what this means.
It means you didn't define removeFromFront for List. You declared the member function, but because it was never defined, the linker complains when it tries to find it.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Error in c++ program

 
0
  #5
Oct 26th, 2004
Midnight Skulke:

Just a couple of FYIs when posting on the forums here:

Firstly, I removed the word "urgent" from your thread title. You post is no more urgent than anyone else's here, and it's rude to assume that it is, just because you have a deadline.

Second, we should enforce this for everyone, but it's especially important when you're posting such long code snippets. Please embed your code in Vbulletin code tags. It's just like HTML; just take your code, and put a [ code] tag at the beginning, and a [ /code] tag at the end. (Remove the space after each [ in the tag-- that's the only way I could get the forum to display the tags.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3
Reputation: Midnight Skulke is an unknown quantity at this point 
Solved Threads: 0
Midnight Skulke Midnight Skulke is offline Offline
Newbie Poster

Re: Error in c++ program

 
0
  #6
Oct 27th, 2004
Hey thanks for the tips. The second problem is the quicksort and bsearch problem. I tried to declare but i'm not sure how to do it. I tried but everytime I run it, it keep saying undeclared idetifier. So can anyone tell me how to solve this:
[ code]
#include <iostream.h>
#include <algorithm>
#include <stdlib.h>

//class quicksort

class qsort
{
public:
int compare(const void*, const void*);


public:
int list;
int element;
//int compare2;
};

//class bsearch

class bsearch
{
public:
int compare(const void*, const void*);


public:
int list;
int element;
int key;


};

int main()
{

int list[10] = {9,5,2,8,1,7,3,6,4,0};
int key = 3;

//display unsorted list

for (int element = 0; element <= 9; element++)
{
cout << list[element] << " ";
}

cout << endl;

qsort (list, 10, sizeof(int), compare1); //error

//display sorted list

for (element = 0; element <= 9; element++)
{
cout << list[element] << " ";
}

//displays whether the number in the array or not

if (bsearch(&key,list,10,sizeof(int), compare2)) //error
{
cout<<key<<" is in the array"<<endl; //number in array
}
else
{
cout << key <<" is NOT in the array2" <<endl; //number not in array
}

return 0;

}

int compare3(const void* a_PTR, const void* b_PTR)
{
return *((int*)a_PTR) - *((int*)b_PTR);
}[ /code]

As you can see the code above, where the remark error is it says compare1 and compare2 undeclare identifier. I tried identifying at private and public as int compare1 and int compare2 but it still gives this error. can you give me a example along explanation Sorry but i'm really weak in C++.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,539
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Error in c++ program

 
0
  #7
Oct 27th, 2004
>I tried to declare but i'm not sure how to do it.
They're already declared in <cstdlib>. If you include the header then you can use the functions, there's no need to try reusing standard names as user defined class names.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC