태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

1강

2010/01/13 00:56 | Posted by 루이



 

#include <iostream> // 전처리
using namespace std;

int main() // main은 오직 반드시 한개가 있어야 된다. int는 return type. void 등이 있다.
{
 // std::cout<<"Programming"<<std::endl; using namespace std;를 넣어주지 않는다면, std::를 넣어서 이렇게 써야된다.
 cout<<"학번"<<endl<<"이름"<<endl; // cout과 endl은 iostream에 위치해있다.
 /* 블록 주석은 중첩될수 없다. */
 return 0;
}


 

#include <iostream>
using namespace std;

int main()
{
 int r;
 cin>>r;
 r=r*r*3.14;
 cout<<r<<endl;
 
 //cout<<'0'<<endl;
 //cout<<'0'+1<<endl;
 //cout<<0+1<<endl;
 return 0;
}



 


#include <iostream> //#은 전처리
using namespace std;
// #define PI 3.141592 // 상수 정의
#include <iomanip> // setw(n)을 사용하기 위한 헤더파일 n칸의 칸중 칸이용 이후 남은칸을 공백으로 표시

int main()
{
 /*
 cout << 10 << endl << 010 << endl << 0X10 << endl;
 //010 8진수 10, 0x10 16진수 10
 cout << "abc\12def" << endl;
 // \8진수숫자 = ASCII코드 상의 명령어 \12는 10번 Line Feed
 cout << 5/2 << endl; // 정수/정수 = 정수
 cout << 5./2. << endl; // 실수/실수 = 실수
 cout << PI*5*5 << endl; // PI는 변수아닌 상수. define 되었기에
 */
 
 /*
 int a,b,c;
 cin >> a >> b >> c;
 cout << a+b+c << endl;
 */

 cout << hex << 65 << endl;
 cout << 10 << dec << endl;
 cout << scientific << 10.5 << endl;
 cout << 5.7 << fixed << endl << 5.7 << endl;
 cout << setw(5) << 10 << setw(5) << 20 << endl;
 cout << internal << setw(5) << -10 << endl;
 return 0;
}


저작자 표시 비영리 변경 금지

Comment

이전 1 ... 7 8 9 10 11 12 13 14 15 ... 219 다음