C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[34680] Re:볼랜드에는 cout<<"abc"<
김용수 [heredity] 1087 읽음    2004-03-24 23:51
안녕하세요. heredity입니다.

질문하신 내용은 Borland C++ Builder에서도 잘 된답니다.
File / New Menu을 누르면 나타나는 New Items Dialog Box에서
New Tab내 Console Wizerd를 선택한 후 ...
편집할 수 있는 상태가 되면 아래 코드를 입력하심 됩니다.
참고로 아래 코드는 도움말에 있는 코드입니다. -.-;;
행복하세요.

//---------------------------------------------------------------------------

#include <vcl.h>
#include <iostream>
#include <iomanip>
#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
  using namespace std;
  int i;
  float f;

  // read an integer and a float from stdin
  cin >> i >> f;
  // output the integer and goes at the line
  cout << i << endl;
  // output the float and goes at the line
  cout << f << endl;
  // output i in hexa
  cout << hex << i << endl;
  // output i in octal and then in decimal
  cout << oct << i << dec << i << endl; 
  // output i preceded by its sign

  cout << showpos << i << endl;
  // output i in hexa
  cout << setbase(16) << i << endl;
  // output i in dec and pad to the left with character
  // @ until a width of 20
  // if you input 45 it outputs 45@@@@@@@@@@@@@@@@@@
  cout << setfill('@') << setw(20) << left << dec << i;
  cout << endl;
  // output the same result as the code just above
  // but uses member functions rather than manipulators
  cout.fill('@');
  cout.width(20);
  cout.setf(ios_base::left, ios_base::adjustfield);

  cout.setf(ios_base::dec, ios_base::basefield);
  cout << i << endl;
  // outputs f in scientific notation with
  // a precision of 10 digits
  cout << scientific << setprecision(10) << f << endl;
  // change the precision to 6 digits
  // equivalents to cout << setprecision(6);
  cout.precision(6);
  // output f and goes back to fixed notation
  cout << f << fixed << endl;
  return 0;
}

+ -

관련 글 리스트
29155 볼랜드에는 cout<<"abc"< YechNet 847 2004/03/24
34680     Re:볼랜드에는 cout<<"abc"< 김용수 1087 2004/03/24
34679     Re:볼랜드에는 cout<<"abc"< YechNet 775 2004/03/24
29158     [답변] 표준은 당연히 됩니다. 정성훈.해미 742 2004/03/24
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.