-7

As am learning cpp tutorial

#include <iostream.h>
using namespace std;

int main()
{
    //variable declaration
    int a,b;
    int c;

    //actual initialization
    a=10;b=20;
    c=a+b;

    cout<<c;
    return 0;
}

my error

fatal error: iostream.h
Mohit Jain
  • 30,259
  • 8
  • 73
  • 100
SAHO
  • 35
  • 1
  • 1
  • 13
  • 3
    If the tutorial is telling you to use ``, it's aimed at C++ as it was 20 years ago, before it was even standardized. – chris May 27 '15 at 05:06
  • 1
    [Step 1] Replace `iostream.h` with `iostream`, [step 2] Switch to some updated tutorial. – Mohit Jain May 27 '15 at 05:09

1 Answers1

2

Just change <iostream.h> to <iostream>

Reason is that .h header extensions were used for C includes but aren't used for C++ anymore.

In fact, you can actually use C libraries with .h it's just there isn't one for iostream since its C++ exclusive, hence the fatal error.

JSelser
  • 3,510
  • 1
  • 19
  • 40
  • can you explain why it should be changed as like – SAHO May 27 '15 at 05:06
  • @reenadevi the tutorial you're using is giving instruction on the C++ language as it was before formal standardization. See this question : [" vs. vs. “iostream.h”"](https://stackoverflow.com/questions/214230/iostream-vs-iostream-h-vs-iostream-h). I *strongly* advise you get another tutorial. – WhozCraig May 27 '15 at 05:11