Skip to content

Commit 368eda3

Browse files
committed
feat: 统一 cpp 文件编码格式为 utf-8
1 parent ade7173 commit 368eda3

File tree

63 files changed

+327
-327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+327
-327
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#include<iostream>
22

33

4-
一种条件编译指令注释
4+
一种条件编译指令注释
55

66

7-
//另一种注释方法
7+
//另一种注释方法
88
#if 0
99
asd
1010
#endif
1111

12-
//打开注释
13-
//条件编译指令
12+
//打开注释
13+
//条件编译指令
1414
#if 1
1515
asData
1616
#endif

practical_exercises/10_day_practice/day1/联合体学习.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include<iostream>
22
using namespace std;
3-
//相同的内存地址
3+
//相同的内存地址
44
union myun
55
{
66
struct { int x; int y; int z; }u;
@@ -11,7 +11,7 @@ int main()
1111
a.u.x =4;
1212
a.u.y =5;
1313
a.u.z =6;
14-
a.k = 0; //覆盖掉第一个int空间值
14+
a.k = 0; //覆盖掉第一个int空间值
1515
printf("%d %d %d %d\n",a.u.x,a.u.y,a.u.z,a.k);
1616
system("pause");
1717
return 0;

practical_exercises/10_day_practice/day10/文件例题/12-1.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//用cin输入字符串数据时,如果字符串中含有空白就不能完整输入。因为遇到空白字符时,cin就认为字符串结束了。
1+
//用cin输入字符串数据时,如果字符串中含有空白就不能完整输入。因为遇到空白字符时,cin就认为字符串结束了。
22
#include<iostream>
33
using namespace std;
44
int main(int argc, char const *argv[])
@@ -11,8 +11,8 @@ int main(int argc, char const *argv[])
1111
return 0;
1212
}
1313
/*
14-
若a的内容是:
14+
若a的内容是:
1515
this is a string!
16-
就难以输入啦!
17-
这样的数据应用输入流类的成员函数输入
16+
就难以输入啦!
17+
这样的数据应用输入流类的成员函数输入
1818
*/

practical_exercises/10_day_practice/day10/文件例题/12-3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include<iostream>
22
using namespace std;
3-
//º¯ÊýÔ­ÐÍ
3+
//函数原型
44
//put(char c)
55
//write(const char*c, int n)
66
int main(){

practical_exercises/10_day_practice/day10/文件例题/12-5.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ int main(){
77
double d=-1234.8976;
88
cout<<setw(30)<<left<<setfill('*')<<c<<"----L1"<<endl;
99
cout<<setw(30)<<right<<setfill('*')<<c<<"----L2"<<endl;
10-
//showbase显示数值的基数前缀
10+
//showbase显示数值的基数前缀
1111
cout<<dec<<showbase<<showpoint<<setw(30)<<d<<"----L3"<<"\n";
12-
//showpoint显示小数点
12+
//showpoint显示小数点
1313
cout<<setw(30)<<showpoint<<setprecision(10)<<d<<"----L4"<<"\n";
14-
//setbase(8)设置八进制
14+
//setbase(8)设置八进制
1515
cout<<setw(30)<<setbase(16)<<100<<"----L5"<<"\n";
1616
system("pause");
1717
}

practical_exercises/10_day_practice/day10/文件例题/12-6.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ int main(int argc, char const *argv[])
66
{
77
fstream ioFile;
88
ioFile.open("./a.dat",ios::out);
9-
ioFile<<"张三"<<" "<<76<<" "<<98<<" "<<67<<endl; //L3
10-
ioFile<<"李四"<<" "<<89<<" "<<70<<" "<<60<<endl;
11-
ioFile<<"王十"<<" "<<91<<" "<<88<<" "<<77<<endl;
12-
ioFile<<"黄二"<<" "<<62<<" "<<81<<" "<<75<<endl;
13-
ioFile<<"刘六"<<" "<<90<<" "<<78<<" "<<67<<endl;
9+
ioFile<<"张三"<<" "<<76<<" "<<98<<" "<<67<<endl; //L3
10+
ioFile<<"李四"<<" "<<89<<" "<<70<<" "<<60<<endl;
11+
ioFile<<"王十"<<" "<<91<<" "<<88<<" "<<77<<endl;
12+
ioFile<<"黄二"<<" "<<62<<" "<<81<<" "<<75<<endl;
13+
ioFile<<"刘六"<<" "<<90<<" "<<78<<" "<<67<<endl;
1414
ioFile.close();
1515
ioFile.open("./a.dat",ios::in|ios::binary);
1616
char name[10];
1717
int chinese,math,computer;
18-
cout<<"姓名\t"<<"英语\t"<<"数学\t"<<"计算机\t"<<"总分"<<endl;
18+
cout<<"姓名\t"<<"英语\t"<<"数学\t"<<"计算机\t"<<"总分"<<endl;
1919
ioFile>>name;
2020
while(!ioFile.eof()) {
2121
ioFile>>chinese>>math>>computer;

practical_exercises/10_day_practice/day10/文件例题/三种输入格式/get()12-2.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//【例12-2】 用函数get和getline读取数据。
1+
//【例12-2】 用函数get和getline读取数据。
22
#include <iostream>
33
using namespace std;
44
int main()
@@ -14,8 +14,8 @@ int main()
1414
}
1515

1616
/*
17-
用法:a = cin.get() ?或者 ?cin.get(a)
18-
结束条件:输入字符足够后回车
19-
说明:这个是单字符的输入,用途是输入一个字符,把它的ASCALL码存入到a中
20-
处理方法:与cin不同,cin.get()在缓冲区遇到[enter],[space],[tab]不会作为舍弃,而是继续留在缓冲区中
17+
用法:a = cin.get() ?或者 ?cin.get(a)
18+
结束条件:输入字符足够后回车
19+
说明:这个是单字符的输入,用途是输入一个字符,把它的ASCALL码存入到a中
20+
处理方法:与cin不同,cin.get()在缓冲区遇到[enter],[space],[tab]不会作为舍弃,而是继续留在缓冲区中
2121
*/
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include<iostream>
22
using namespace std;
33
/*
4-
(1)cin.getline(arrayname,size)与cin.get(arrayname,size)的区别
5-
cin.get(arrayname,size)当遇到[enter]时会结束目前输入,他不会删除缓冲区中的[enter]
6-
cin.getline(arrayname,size)当遇到[enter]时会结束当前输入,但是会删除缓冲区中的[enter]
4+
(1)cin.getline(arrayname,size)与cin.get(arrayname,size)的区别
5+
cin.get(arrayname,size)当遇到[enter]时会结束目前输入,他不会删除缓冲区中的[enter]
6+
cin.getline(arrayname,size)当遇到[enter]时会结束当前输入,但是会删除缓冲区中的[enter]
77
*/
88
int main()
99
{
@@ -12,27 +12,27 @@ int main()
1212
char b;
1313
cin.get(a,10);
1414
cin.get(b);
15-
cout<<a<<endl<<int(b);//输入:12345[enter] 输出:12345 【换行】 10*/
15+
cout<<a<<endl<<int(b);//输入:12345[enter] 输出:12345 【换行】 10*/
1616
/*char c[10];
1717
char d;
1818
cin.getline(c,10);
1919
cin.get(d);
20-
cout<<c<<endl<<int(d);//输入:12345[enter]a[enter] 输出:12345【换行】97*/
21-
//cin.getline(arrayname,size,s)与cin.gei(arrayname,size,s)的区别
20+
cout<<c<<endl<<int(d);//输入:12345[enter]a[enter] 输出:12345【换行】97*/
21+
//cin.getline(arrayname,size,s)与cin.gei(arrayname,size,s)的区别
2222
/*
23-
cin.getline(arrayname,size,s)当遇到s时会结束输入,并把s从缓冲区中删除
24-
cin.get(arrayname,size,s)当遇到s时会结束输入,但不会删除缓冲区中的s
23+
cin.getline(arrayname,size,s)当遇到s时会结束输入,并把s从缓冲区中删除
24+
cin.get(arrayname,size,s)当遇到s时会结束输入,但不会删除缓冲区中的s
2525
*/
2626
/*
2727
char e[10];
2828
char f;
2929
cin.get(e,10,',');
3030
cin.get(f);
31-
cout<<e<<endl<<f;//输入:12345,[enter] 输出:12345【换行】,说明:cin,get不会删除缓冲区的,*/
31+
cout<<e<<endl<<f;//输入:12345,[enter] 输出:12345【换行】,说明:cin,get不会删除缓冲区的,*/
3232
char e1[10];
3333
char f1;
3434
cin.getline(e1,10,',');
3535
cin.get(f1);
36-
cout<<e1<<endl<<f1;//输入:asd,wqe 输出:asd【换行】w
36+
cout<<e1<<endl<<f1;//输入:asd,wqe 输出:asd【换行】w
3737
system("pause");
3838
}

practical_exercises/10_day_practice/day10/文件例题/重要!!!课堂练习.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include<iostream>
22
#include<fstream>
3-
//向量是一个能够存放任意类型的动态数组
3+
//向量是一个能够存放任意类型的动态数组
44
#include<vector>
55
#include<cstring>
66
using namespace std;
@@ -25,20 +25,20 @@ class Person{
2525
int main(int argc, char const *argv[])
2626
{
2727
vector<Person> v;
28-
vector<Person>::iterator pos;//声明一个迭代器,来访问vector容器,作用:遍历或者指向vector容器的元素
28+
vector<Person>::iterator pos;//声明一个迭代器,来访问vector容器,作用:遍历或者指向vector容器的元素
2929
char ch;
3030
ofstream out("d:/person.dat",ios::out|ios::app|ios::binary);
3131
char Name[20],ID[18],Addr[20];
3232
int Age;
33-
cout<<"------输入个人档案------"<<endl<<endl;
33+
cout<<"------输入个人档案------"<<endl<<endl;
3434
do{
35-
cout<<"姓名: ";
35+
cout<<"姓名: ";
3636
cin>>Name;
37-
cout<<"身份证号: ";
37+
cout<<"身份证号: ";
3838
cin>>ID;
39-
cout<<"年龄: ";
39+
cout<<"年龄: ";
4040
cin>>Age;
41-
cout<<"地址: ";
41+
cout<<"地址: ";
4242
cin>>Addr;
4343
Person per(Name,ID,Age,Addr);
4444
out.write((char*)&per,sizeof(per));
@@ -53,7 +53,7 @@ int main(int argc, char const *argv[])
5353
v.push_back(s);
5454
in.read((char*)&s,sizeof(s));
5555
}
56-
cout<<"\n---------从文件中读出的数据--------"<<endl<<endl;//L15
56+
cout<<"\n---------从文件中读出的数据--------"<<endl<<endl;//L15
5757
pos=v.begin();
5858
for(pos=v.begin();pos!=v.end();pos++)
5959
(*pos).display();

practical_exercises/10_day_practice/day2/掷骰子.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ int main(int argc, char const *argv[])
66
{
77
int flag;
88
unsigned seed;
9-
cout<<"ÇëÊäÈëÎÞ·ûºÅÕûÊý£º"<<endl;
9+
cout<<"请输入无符号整数:"<<endl;
1010
cin>>seed;
1111
srand(seed);
1212
int sum = rolldice();

0 commit comments

Comments
 (0)