5 Replies - 6923 Views - Last Post: 01 December 2010 - 06:31 AM Rate Topic: -----

#1 issyl  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 118
  • Joined: 25-October 10

Using namespace std error

Posted 01 December 2010 - 05:33 AM

I have an error :

Declaration syntax error. How do i fix these? In our book, we have to include using namespace std for a reason i dont know why. In our book it was written for the purpose of cout instaed of std:: cout... Pls take a look at my program.


#include <iostream.h>
#include <iomanip.h>
#include <conio.h>

using namespace std;
int main()
{
	int a = 23;
	int b = 34;

	cout << "Line 3: Enter a number followed" << " by a character: ";
	cin >> a >> b;
	cout << endl << "Line 5: a = " << a << ", b = " << b << endl;

	cin.clear();
	cin.ignore(200, '\n');

	cout << "Line 8: Enter two numbers: ";
	cin >> a >> b;
	cout << endl << "Line 10: a = " << a << ", b = " << b << endl;


	return 0;
}


This post has been edited by issyl: 01 December 2010 - 05:35 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Using namespace std error

#2 shad0wk1  Icon User is offline

  • D.I.C Head

Reputation: 31
  • View blog
  • Posts: 139
  • Joined: 01-October 10

Re: Using namespace std error

Posted 01 December 2010 - 05:54 AM

Do you use Borland or Turbo C++?

If i am not mistaken, both of them does not need using namespace std; I can't explain well about this, but that what I experienced with the differences between using borland and devc++.
Was This Post Helpful? 1
  • +
  • -

#3 issyl  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 118
  • Joined: 25-October 10

Re: Using namespace std error

Posted 01 December 2010 - 05:57 AM

ohhhh.. im using turbo c++ thats why thanks alot! oh yeah
Was This Post Helpful? 0
  • +
  • -

#4 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Using namespace std error

Posted 01 December 2010 - 06:05 AM

Can you use a compiler from some time this decade? The std namespace has been in place for over a decade.
Was This Post Helpful? 0
  • +
  • -

#5 issyl  Icon User is offline

  • D.I.C Head

Reputation: -5
  • View blog
  • Posts: 118
  • Joined: 25-October 10

Re: Using namespace std error

Posted 01 December 2010 - 06:20 AM

sorry... but that's what our school taught us. i cannot do anything about it... so just pls understand...
Was This Post Helpful? 0
  • +
  • -

#6 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Using namespace std error

Posted 01 December 2010 - 06:31 AM

Why do you apologize to me? I'm not the one who's being paid money and then teaching something that has been outdated for well over a decade. Your school on the other hand...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1