-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path运算符.cpp
51 lines (47 loc) · 1.1 KB
/
运算符.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Created by me on 2020/4/9.
//
#include <iostream>
using namespace std;
int main() {
// int a1 = 10;
// int b1 = 3;
//
// cout << a1 + b1 << endl;
// cout << a1 - b1 << endl;
// cout << a1 * b1 << endl;
// cout << a1 / b1 << endl;//两个整数相除,结果依然是整数,将小数部分去除
// cout << a1 % b1 << endl;//取摸(取余)运算
//
// int a2 = 10;
// int b2 = 20;
// cout << a2 / b2 << endl;
//
// //除数不能为0
//// int a3=10;
//// int b3=0;
//// cout << a3/b3<<endl;
//
////两个小数相除
// double d1 = 0.5;
// double d2 = 0.22;
// cout << d1 / d2 << endl;
//
// int a3=10;
// int b3=0;
// cout << a3 % b3 <<endl;
// //两个小数是不能做取模运算的,只有整型才可以进行取模运算
// double d3=3.14;
// double d4=1.1;
// cout << d3 % d4<<endl;
// 前置递增余后置递增
int a4 =10;
int b4 =++a4 *10;
cout <<"a4="<<a4<<endl;
cout<<"b4="<<b4<<endl;
int a5=10;
int b5=a5++ *10;
cout << "a5="<<a5<<endl;
cout <<"b5=" <<b5<<endl;
//前置递减余后置递减
}