Hi, i'm having a few problems when debugging my project.
Basically i have two errors;

Error 2 error C2065: 'cout' : undeclared identifier

Error 3 error C2065: 'cin' : undeclared identifier

This is where the errors are (It's a header file)

int temp;
cout<<"Enter the Client Number : ";
cin>>temp;

I declared these in the .cpp file

case 2:
cout<<"Enter your client number : ";
cin>>temp; pcompany.getcdata(temp);
break;

And i have 1 warning also in the .cpp file

Warning1 warning C4101: 'temp' : unreferenced local variable

Please help if you can.
Thanks

Did you include <iostream>? Do you have a using directive for std

using namespace std;

or a using declaration for each standard name

using std::cout;
using std::cin;

at appropriate locations?

Yes, i included <iostream> and using namespace std;
Where should i put std::cout; and std::cin; ??

If you've used "using namespace std;" then putting "using std::cout;" and "using std::cin;" isn't required.

using namespace std;
property::property()
{
     numdata=0;
     ifstream readData;    
     int temp;
     readData.open("output.txt");           //read the property details data from output.txt
     if (readData.is_open())
     {
        while(!readData.eof())                     //read the property file which is end of file or not
        {
            readData>>propertydata[numdata].clientno;            
            readData>>propertydata[numdata].cname;               //read the property details 
            readData>>propertydata[numdata].ptype;
            readData>>propertydata[numdata].pprice;
            readData>>propertydata[numdata].numbedrooms;
            readData>>propertydata[numdata].location;
            readData>>propertydata[numdata].garage;
            readData>>propertydata[numdata].garden;  
            numdata++;           
        }
        numdata--;
     }
     readData.close();
}
void property::NewClient()
{
    int temp;
    cout<<"Enter the Client Number : ";
    cin>>temp;

    if(!existcnum(temp))
    {
        propertydata[numdata].clientno=temp;
        cout<<"Enter the Client Name : ";
        cin>>propertydata[numdata].cname;
        cout<<"Property Type [B]uy/[S]ell : ";
        cin>>propertydata[numdata].ptype;                          //read the property details using client number
        cout<<"Enter the Property Price : ";
        cin>>propertydata[numdata].pprice;
        cout<<"Number of Bed Rooms : ";
        cin>>propertydata[numdata].numbedrooms;
        cout<<"Propery Location : ";
        cin>>propertydata[numdata].location;
        cout<<"Garage [Y/N] : ";
        cin>>propertydata[numdata].garage;
        cout<<"Garden [Y/N] : ";
        cin>>propertydata[numdata].garden;
        numdata++;
    }
}

THE ERRORS APPEAR ON;

int temp;
cout<<"Enter the Client Number : ";
cin>>temp;

Edited 3 Years Ago by pyTony: fixed formatting

Added info.
I have 3 files; 2 are .cpp and 1 is .h
The code above is from the second .cpp
Hope this helps

This is from the 1 .cpp

#include <iostream>
#include <conio.h>
 
#include <string>
#include "property.cpp"

using namespace std;


int main()
{
    property pcompany;
    void getdata(property &);
    void menu();
   
    int choice=0,temp;
    float tpprice;
    string tptype;    
    while(true)
    {
        menu();
        cin>>choice;                                //read users choice
        if(choice==7)break;
        switch(choice)
        {                                           
            case 1:
                  pcompany.NewClient();                //Call new Client method
                  break;
                  
                  case 2:
                  cout<<"Enter your client number : ";
                  cin>>temp;                                 //read client number and call getcdata funtions
                  pcompany.getcdata(temp);
                  break;

Edited 5 Years Ago by Narue: Added code tags

Why are you including a .cpp file? The general structure of the the files should be like

main.cpp: This is the cpp file where main is. You can call it anything. In this file you will include all header files needed

className.h: This is where the declaration of the class goes

className.cpp: This is where you define your class.

//main.cpp
#include <iostream>
#inlcude "Player.h"
#inlcude "Game.h"

int main()
{
    //...
}
//  player.h
class Player
{
   // just the declaration
};

// player.cpp
Player::Player()
{
    //...
}

Player Player::GetName() const { return name; }

//...
// game.h
class Game
{
    // just the declaration
};

// game.cpp
Game::Game()
{
    //...
}

Player Game::GetPlayer(int index) const { return Players[index]; }

Update: After seeing all of the OP's code through a private message, I confirmed that <iostream> wasn't included in all of the files where cin and cout are referenced.

This question has already been answered. Start a new discussion instead.