0

I have got problems with printing of my code . I want to print a stack in which i have stored nothing and the size of stack is 5 elements from 0-4 . In the code I am using aggregation and hae defined 2 (.h) files CComplex and ClifoBuffer

#include <iostream>              
#include <stdlib.h>

#ifndef CLIFOBUFFER_H
#define CLIFOBUFFER_H
#include "CComplex.h"

class ClifoBuffer
{
public:

    ClifoBuffer(int size);
    ~ClifoBuffer();
     void print();
     bool push(const CComplex& data);
private:
    int m_size;


    CComplex* m_pBuffer;
    int m_tos;
};


In ClifoBuffer function print is invoked 

void ClifoBuffer::print()
{
    cout<<"CLifoBuffer at  "<<this<<endl;
    cout<<"m_tos=  "<<m_tos<<endl;

    for(int i=0;i<m_size;i++)
    {
        cout<<i<<".      "<<m_pBuffer[i]<<endl;

    }
}

whenever i build the solution I get the following error

binary '<<' : no operator found which takes a right-hand operand of type 'CComplex' (or there is no acceptable conversion)

kindly help

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by teo236
0
cout<<i<<". "<<m_pBuffer[i]<<endl;//m_pBuffer[i] is a CComplex

CComplex is a class and you can't print it in this case. Maybe you could try printing a value contained in that class.

Edited by teo236: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.