compiler not working properly

Ashokkumar01cbe

Broken In
Hi,
first my system specs is windows 7 ultimate 64 bit. i5 processor,4 GB RAM,I am using codeblocks software for the compilation of my c programs. yesterday i do a little program in c++ .i gave the header file <iostream.h>
it shows up that there is no such file in the directory.please help me to solve the issues.............:confused:
 

krishnandu.sarkar

Simply a DIGITian
Staff member
Well, which compiler you are using?

And BTW iostream.h is obsolate instead use "#include<iostream>"

Then at next line use "using namespace std;"
 

Vyom

The Power of x480
Staff member
Admin
A sample program which compiles on GCC compiler in code::blocks. Should give you a head start:

PHP:
#include<iostream>

using namespace std;

class item
{
    private:
        int item_code;
        float price;

    public:
        void initialize(int c, int p)
        {
            item_code = c;
            price = p;
        }

        void input()
        {
            cout<<"\nEnter item code : ";
            cin>>item_code;
            cout<<"\nEnter item price : ";
            cin>>price;
        }

        void display()
        {
            cout<<"\n"<<item_code<<"\t"<<price;
        }
};

int main()
{
    item item[5];

    for(int i=0; i<5; i++)
    {
        cout<<"\n\nEnter details of Item # "<<i+1;
        item[i].input();
    }

    cout<<"\nItem\tPrice";
    for(int i=0; i<5; i++)
    {
        item[i].display();
    }

    return 0;
}
 
Top Bottom