-3

I have written this code from a book i am reading but my complier warns be that symbol cout and endl could not be resolved. Why is that.

#include <iostream>
#include <float.h>

int main()

{
    cout << "float: " << endl
         << "stevilo decimalnih mest: " << FLT_DIG         << endl
         << "natancnost stevila....: " << FLT_EPSILON      << endl
         << "Najmanjse stevilo.....: " << FLT_MIN          << endl
         << "Najvecje stevilo......: "  << FLT_MAX         << endl
         << "Bitov v mantisi.......: "  << FLT_MANT_DIG    << endl
         << "Najvecji eksponent....: "  << FLT_MAX_10_EXP  << endl
         << "Najmlajsi eksponent...: "  << FLT_MIN_10_EXP  << endl;

    return 0;
}
EdChum
  • 376,765
  • 198
  • 813
  • 562
Žiga Gazvoda
  • 173
  • 1
  • 9

2 Answers2

0

cout and endl are scoped. So you have to inform in which namespace there are.

Use

std::cout
std::endl

or badly add just after include

using namespace std;
Garf365
  • 3,619
  • 5
  • 29
  • 41
0

You would have to use namespace:

#include <iostream>
#include <float.h>
using namespace std;

or:

std::cout

You can read more about namespaces in c++ here

M G
  • 1,240
  • 14
  • 26
  • 1
    I dont like the phrasing "would have to use namespace". There is really no need to do so. Actually there are good reasons not do it (see e.g. [here](http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice)). – 463035818_is_not_an_ai Feb 05 '16 at 15:41
  • @tobi303 "would have to use(...) OR std::" – M G Feb 06 '16 at 21:02