'identifier display cannot have type qualifier'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhijit mudugan
    New Member
    • May 2011
    • 2

    'identifier display cannot have type qualifier'

    i'm getting an error 'identifier display cannot have type qualifier' near the bold portion. what's wrong???
    Code:
    #include<iostream.h>
    #include<conio.h>
    #include<stdio.h>
    #include<stdlib.h>
    class matrix
    {
    private: int a[20][20],m,n;
    public:
    void getdata();
    void display();
    matrix operator+(matrix c) ;
    
    };
    void matrix::getdata()
    {
    cout<<"enter size"<<endl;
    cin>>m>>n;
    cout<<"enter elements"<<endl;
    for(int i=0;i<=m;i++)
    {for(int j=0;j<=n;j++)
    cin>>a[i][j];
    
    }
    [B]void matrix::display()
    {[/B]
    for(int i=0;i<=m;i++)
    {
    for(int j=0;j<=n;j++)
    cout<<a[i][j];
    cout<<endl;
    }
    matrix matrix :: operator+(matrix c)
    {
    matrix l;
    if(m!=c.m||n!=c.n)
    {cout<<"sdsd";
    exit(0);
    }
    else
    {
    l.m=m;
    l.n=n;
    for(i=0;i<=m;i++)
    {for(j=0;j<=n;j++)
    l.a[i][j]=a[i][j]+c.a[i][j];
    } }
    return l;
    }
    
    void main()
    {
    matrix x,y,z;
    clrscr();
    x.getdata();
    y.getdata();
    z=x+y;
    z.display();
    getch();
    }
    Last edited by Niheel; May 15 '11, 10:03 PM.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    There's no closing parenthesis on matrix::getdata ().

    Comment

    • abhijit mudugan
      New Member
      • May 2011
      • 2

      #3
      here i get en error 'improper use of typedef 'matrix''
      matrix matrix :: operator+(matri x c)
      {
      matrix l;
      if(m!=c.m||n!=c .n)
      {cout<<"sdsd";
      exit(0);
      }

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        It's the same issue as before. There is no closing } on matrix::display ().

        Comment

        Working...