MC felon wrote:
> I got myself dev c++. i tried (and for the first time) using 'std::'
> for everything like cin, cout, getline etc.
> it doesnt work! this program gave me 7 errors!!!!!!!
> (dont mind conio2.h, it's the extra conio that handles many old
> functions)
> #include <iostream.h>
#include <iostream>
#include <string>
> #include <conio2.h>
> int main()
> {
> std::string str;
> getline(std::cin,str,'\r');
> std::cout<<"hi...\n\n";
> std::cout<<str;
> getch();
> }
In headers, you definitely want to use std:: and in source files, you
can do as follows:
#include <iostream>
#include <ostream>
#include <string>
int main()
{
using std::string;
using std::cout;
using std::endl;
string s_line(10, '-');
cout << s_line << endl;
}
|