#include <iostream.h>
int main()
{
cout << "2 + 2 = " << 2 + 2 << endl;
cout << "1 - 5 = " << 1 - 5 << endl;
cout << "2 * 9 = " << 2 * 9 << endl;
cout << "9 / 3 = " << 9 / 3 << endl;
cout << "9 / 2 = " << 9 / 2 << endl;
return 0;
}
#include <iostream.h>
int main()
{
cout << "9 / 2 = " << 9 / 2 << endl;
cout << "9 % 2 = " << 9 % 2 << endl;
cout << "2 + 2 * 4 = " << 2 + 2 * 4 << endl;
cout << "(1 - 5) / 2 = " << (1 - 5) / 2 << endl;
return 0;
}
이 장의 요점
-곱셈에는 asterisk(*), 나눗셈에는 slash(/)를 사용한다.
-나머지는 퍼센트 기호(%)를 사용한다.
-연산의 우선 순위는 상식적
[첨부파일]
'C++' 카테고리의 다른 글
6. 내용을 바꾸자 (0) | 2012.05.11 |
---|---|
5. 변수 (0) | 2012.05.11 |
4. 다음 프로그램으로 이동하기 전에 (0) | 2012.05.11 |
2. Hello 프로그램 (0) | 2012.05.11 |
1. Visual C++ 사용법 (예제로 배우는 C++ 프로그래밍, 송호중 저) (0) | 2012.05.11 |