C++ String Class Help

error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (
or there is no acceptable conversion)
Error executing cl.exe.

I keep getting that error when I try to cout a array from a structure. This is the piece of code.
#include <iostream.h>
#include <string>
using namespace std;

struct record{
      int key;
      string firstName;
      string lastName;
      int studentid;
      int courseID;
      string coursename;
      double courseMark;

string Getfirstname();

int main(void)
      record Database[100];//reserve memory for 100 records
      int i=0;
      char reply;

      cout<<"\nwould you like to enter another student in the database? (y) or (n) ";
      cout<<Database[0].firstName; //THIS LINE ERROR

return 0;

string Getfirstname(void){
char firstName[50]; string final;
cout <<"\nplease enter the number of hours worked ";
return firstName;


Anyone got any suggestions please.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Drop the .h from iostream.h:
#include <iostream>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
flukedAuthor Commented:
thank you a lot. Do you know why I had to remove the h from the input/output class ?
The simple answer is because it's in the standard

It centres around the std namespace. Don't mix and match the old and new headers.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

flukedAuthor Commented:
ok Thank you im a newbie at c++ ;)
I've often seen this:

namespace MyNS
#include <map>

and it confuses the compiler big time.
flukedAuthor Commented:
ahh that can be a big mess
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.