Can any one help me with these codes: i m freaking out here

I split my program in 3 parts.
1. main - prac.cpp
2. interface - base.h
3. implementation - base.cpp

in prac.cpp the code is:

#include <iostream>
using namespace std;

#include "base.h"

int main(){
	Base ob;

	ob.set();
	ob.get();

	system("pause");

	return 0;
}

in base.h the code is:

#ifndef BASE_H
#define BASE_H

#include <string>

class Base{
	string word;
public:
	void get();
	void set();
};

#endif

and in base.cpp the code is:

#include "base.h"

void base::set(){
	cin >> word;
}
void base::get(){
	cout << word << endl;
}

i got this error: "Error 1 error C2146: syntax error : missing ';' before identifier 'word' in "base.h" " in visual 2008


any help is highly appreciated...... thanks in advance

try
std::string word
std::cin
std::cout

#include <iostream> first in your base.h

#include <iostream> first in your base.h

can u please explain why? i've used it already but no good...:(
why do u think i've to include it??

pls explain, why isn't this working?? what's wrong with this code??

i got this error: "Error 1 error C2146: syntax error : missing ';' before identifier 'word' in "base.h" " in visual 2008

the error you are getting for "string". you will need to tell the compiler where string is defined. cin, cout are defined in iostream.h header file under namespace std. Also string is defined under std namespace.

try
std::string word
std::cin
std::cout

Thanx it worked..:) but can you pls explain why my code isn't working. it seemed to me i got everything right. i m confused here...

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.