- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp_3_8_chapter1.cpp
More file actions
Latest commit
36 lines (29 loc) · 682 Bytes
/
Copy pathcpp_3_8_chapter1.cpp
File metadata and controls
36 lines (29 loc) · 682 Bytes
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
#include<iostream>
intmain(int argc, charconst *argv[])
{
int value = 0, sum = 0;
while(std::cin >> value){
sum += value;
}
std::cout << "sum = " << sum << std::endl;
int a{1};
int &b{a};
int *p{&a};
int &q{*p};
std::cout << b << std::endl;
int i{10};
constint &j{i}; // 引用
int &k{i};
std::cout << i << '\t' << j << '\t' << k << std::endl;
k = 5;
std::cout << i << '\t' << j << '\t' << k << std::endl;
int i2{0};
constint *const l{&i2};
printf("%d",*l);
int n;
std::cin >> n;
constexprint m = 3;
std::cout << m << std::endl;
constexprint *c{0};
return0;
}