-2

I declared string array like string pdts[10]; But am getting declaration syntax error.Already i included still am getting the same error. please help me to solve. my code is

#include<iostream.h>
#include<string.h>
string pdts[10];
deeiip
  • 3,319
  • 2
  • 22
  • 33
Madhumitha
  • 3,794
  • 8
  • 30
  • 45

2 Answers2

5

First, if you are in c++ you should do like:

#include<iostream>
#include<string>

Second, either use:

using namespace std;

Or, use fully qualified name std::string

deeiip
  • 3,319
  • 2
  • 22
  • 33
1

you should use:

using namespace std;

without it, it will give you an error.

Bramsh
  • 389
  • 1
  • 2
  • 14
  • 1
    Whilst this will work, you should avoid this whenever possible and fully qualify the name instead. Take a look at [this](http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice) – OMGtechy Mar 30 '14 at 14:19