class inside class

Pages: 12
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.
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
Helloooo
You didn't give a template argument for the return Queue type.
thanks Bazzy
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( );
The for doesn't have braces.
The if's true block never closes.
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
thanks a lot guys
Topic archived. No new replies allowed.
Pages: 12