PDA

View Full Version : Depreciated/antiquated iostream.h



ThePyro
04-26-2004, 07:05 AM
Im having a little trouble with iostream.h.
Compiler (Dev-C++), Tells me my iosrteam.h is antiquated.
Bear with me i started this about 12 hours ago.



#include <iostream.h>
int main()
{
int a;
cout<<"Simple Test file";
cout<<"Punch in a random Number: ";
cin>>a;
cout<<"You entered: "<<a;
return 0;
}

also, how do you make the dos box stay untill an "Anykey" event, without opening it manually through the box
Thanks

Salem
04-26-2004, 07:16 AM
That's the old way - hence it is deprecated

The new way is to begin your programs with


#include <iostream> // Note, no .h
using namespace std; // all your small programs will only use the std namespace


> Also, is Break; the tag for a new line, if not, what is?
It's a keyword used to break out of loops
Since you're not in a loop at that point in the code, it is a coding error.

ThePyro
04-26-2004, 07:23 AM
Sorry i didn't make an edit fast enough, i figured out the break thing on my own.
how do you make the dos box stay untill an "Anykey" event, without opening it manually through the box.
and what is the new line command, so you dont end up with the 2 "Cout"s on the same line

Fordy
04-26-2004, 07:38 AM
Try the faq - http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042856625&id=1043284385

Speedy5
04-26-2004, 01:23 PM
> and what is the new line command, so you dont end up with the 2 "Cout"s on the same line

Add a \n character to your string. However, this does not flush the stream. It is always good practice to flush your streams when you want data to show up on the screen.

cout << "Hello\n"; // doesn't flush
cout << "Hello\n" << flush; // ok
cout << "Hello" << endl; // *recommended way*