This is the full code and the single error!!!!!

1>d:\s\o.o\hws\new folder\shop\shop\main.cpp(37): fatal error C1075: end of file found before the left brace '{' at 'd:\s\o.o\hws\new folder\shop\shop\shop.h(8)' was matched

#include<iostream>
#include<string>
using namespace std;

#ifndef SHOP_H
#define SHOP_H

class Shop{
    friend ostream &operator<<(ostream &output,const Shop &S){
        output<<"\nThe name of the shop is:\t"<<S.name;
        output<<"\nThe total number of items sold in this shop is:\t"<<S.total;
        output<<"\nThe price of the items sold in the shop is:\t"<<S.price<<"  JD";
        output<<"\nThe area of this shop is:\t"<<S.area<<"  m^2"<<endl;

        return output;
    }

    friend istream &operator>>(istream &input,Shop &S){
        input>>S.name;
        input>>S.total;
        input>>S.price;
        input>>S.area;

        return input;
    }

private:
    string name;
    int total;
    int price;
    int area;

public:
    Shop(string n="Baby Shop",int t=70,int p=200,int a=200){
        name=n;
        total=t;
        price=p;
        area=a;
    }

    Shop(const Shop &copy){
        name=copy.name;
        total=copy.total;
        price=copy.price;
        area=copy.area;
    }

    operator double(){
        return (total*price);
    }

    int &operator[](int index){
        if(index==8)
            return price;
        else
            cerr<<"Erorr,invalid index\n";

        if(index==7.5)
            return area;
        else
            cerr<<"Erorr,invalid index\n";
    }

    int operator[](int index)const{
        if(index==8)
            return price;
        else if(index==7.5)
            return area;
        else
            cerr<<"Erorr,invalid index\n";
    }

    bool operator==(const Shop &right)const{
        return (*this==right);
    }
         
    bool operator<(const Shop &right)const{
        return (total<right.total);
    }

    Shop operator+(const Shop &a){
        return Shop(name,total+a.total,price+a.price,area+a.area);
    }

    const Shop &operator=(Shop &right){
        if(this!=&right){
        name=right.name;
        total=right.total;
        price=right.price;
        area=right.area;
        }
        return *this;
    }

    Shop &operator--(){
        --total;
        --price;
        --area;
        return *this;
    }

    Shop operator--(int){
        Shop save=*this;
        total--;
        price--;
        area--;
        return save;
    };
#endif
#include<iostream>
#include<string>
using namespace std;

#include "Shop.h"

int main()
{
    Shop Mid;
    cout<<Mid<<endl<<Mid[10]<<endl;

    Shop Small("Lady Shop",50,150,100);
    cout<<Small<<endl<<Small[8]<<endl;

    Shop New;
    cout<<"Enter the name,the total number of items sold,\n"
        <<"the price of the items sold and the area of the New shop. \n";
    cin>>New; 
    cout<<endl<<New<<endl<<New[7.5]<<endl;

    cout<<Mid--<<endl;
    cout<<--Mid<<endl;

    Shop Large=Mid;
    cout<<(Large==Mid)<<endl<<(Large==Small)<<endl;

    cout<<(Mid<Small)<<endl;
    New=(Small+Large);
    cout<<New<<endl;

    double x;
    x=Small;
    cout<<x<<endl;

    return 0;
}

Recommended Answers

All 2 Replies

You see this opening brace, "{", in your code?

class Shop{

Where is the closing brace that goes with it?

You see this opening brace, "{", in your code?

class Shop{

Where is the closing brace that goes with it?

Thank you for helping me, I am attending now to my error and I am repairing my code.

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.