solved  class inside class

Zhuge (324)   Link to this post
You want to move an arbitrary element of the array to the front, and move the other elements over? You could just swap it down the array, I guess.
olove05 (59)   Link to this post
What does mean?

queue.cpp:149: error: expected constructor, destructor, or type conversion before âQueueâ
1
2
template <class T>
Queue Queue<DataType>::Mutofront( T Muele,int n)// in this part of code 


1
2
P.cpp:38: error: no matching function for call to âQueue<int>::Mutofront(Queue<int>&, int&)â
queue.cpp:160: note: candidates are: int Queue<DataType>::Mutofront(T, int) [with DataType = int]
Last edited on
olove05 (59)   Link to this post
Helloooo
Bazzy (3180)   Link to this post
You didn't give a template argument for the return Queue type.
olove05 (59)   Link to this post
thanks Bazzy
olove05 (59)   Link to this post
I working with these functions to move to the front the nth element, Can some one figure out those errors

queue.cpp: In member function âvoid Queue<DataType>::Mutofront(const Queue<T>&, int)â:
queue.cpp:174: error: expected primary-expression before âelseâ
queue.cpp:174: error: expected `;' before âelseâ




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void Queue<DataType>::Mutofront(const Queue<T>& Muele,int n)
{

       for (int i = 0 ; i <3; i++){

         if ( n == ele[i]){
              cout<<"the element is:"<<ele[i]<<endl;

             for( int j = 0; j<3; j++)
               
                  int temp = ele[i];
                  
                  ele[i]= ele[j];
                 
                      ele[j] = temp;


         else
            cout<< "No mach"<<endl;
      }
   }

 Display( );
helios (4790)   Link to this post
The for doesn't have braces.
The if's true block never closes.
Bazzy (3180)   Link to this post
You have if closing brace at the wrong position, you should move it before else
You should also enclose lines 11-15 in braces to be executed inside the for loop
olove05 (59)   Link to this post
thanks a lot guys

Pages: [1] [2]


Registered users can post in this forum.