class brick
{ private: 
    int  length, width, height;// in mm
  public: 
    void set(int len, int wid, int hei);
    int getlength(){return length;}
    int getwidth(){return width;}
    int getheight(){return height;}
    };

void brick::set(int len, int wid, int hei)

{   length=len;width=wid;height=hei;}

#include <iostream>
using namespace std;

/*After Set() method write main() function which would have one object of type Brick. Display
the data of the object. Write sentences for displaying output on the screen in the beginning of program file:*/

int main()
{
    brick b1;
    b1.set(250,120,88);

    cout<<"brick height is:"<<b1.getheight()<<endl;
        cout<<"brick length is:"<<b1.getlength()<<endl;
            cout<<"brick width is:"<<b1.getwidth()<<endl;


/*Extend the program with variables to store house wall height, length and width in meters:also Extend the program to
calculate required number bricks of type 1  for house walls:*/

double hwalllen=12.0,hwallwid=0.23,hwallhei=3.0;                 // storing wall data
int b1n;                                                       //no of b1  bricks required
b1n= (hwalllen*100/b1.getlength())*(hwalllen*100/b1.getlength())*(hwalllen*100/b1.getlength());
cout<< " the no of type 1 bricks required for one wall:"<< b1n;
return(0);
}

This error is coming while running: 

Error 1 error C1075: end of file found before the left brace '{' at 'c:\users\kumar anubhav\documents\labclass1\brick.cpp(19)' was matched c:\users\kumar anubhav\documents\labclass1\brick.cpp 20 1 labclass1

But if I remove 34 to 37 lines, it wshows no error and runs properly...please help

Recommended Answers

All 3 Replies

please help as this is not a problem of curly brace matching. If i remove the folloing part of code, it works...

double hwalllen=12.0;
    double hwallwid=0.23;
    double hwallhei=3.0;                 // storing wall data
    int q;                                                       //no of b1  bricks required
    q= hwalllen*1000 / b1.getlength()*
    hwallwid*1000 / b1.getwidth()*
    hwallhei*1000 / b1.getheight();
cout<< " the no of type 1 bricks required for one wall:"<<4 * q;

If i remove above part it woeks..please help...

I was able to compile this without changes using VS2013... what are you using?

commented: thax its now working ...... +0

If you indent you code correctly we might be able to help you better.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.