cout / cin / endl 에 대하여...
#include<stdio.h>
namespace mystd
{
char* endl = " \n";
class ostream
{
public:
ostream& operator<<(char * str)
{
printf("%s",str);
return *this;
}
ostream& operator<<(int i)
{
printf("%d",i);
return *this;
}
ostream& operator<<(double i)
{
printf("%e",i);
return *this;
}
};
ostream cout;
}
using mystd::cout;
using mystd::endl;
int main()
{
cout<<"Hello world"<<100<<endl;
cout<<endl;
return 0;
}
그냥..그렇다고.-_-흉내 낸거라는... 군...
cout<<"출력 대상"
cin>>"입력 대상"
cout 은 std namespace 공간에 정의되어있는 ostream 클래스의 객체이다.
cin 은 std namespace 공간에 정의되어있는 iostream 클래스의 객체.
c++에서 헤더파일 인크루드 하는 것은 iostream 이다
istream ,ostream 에 대한 것을 합쳐서 있는 것이 iostream임..
istream = input streamostream = output stream 이라고 보시면 될듯 싶다는군....
나중에 보시면buffer 관련된 스트림도 있다는.....파일에서 바로 데이터를 읽어서 처리하는 stream이죠.
cin, cout 등등. 값 입력 및 출력하는 것에 관련된 것입니다.