Skip to content

Commit

Permalink
上传学习代码
Browse files Browse the repository at this point in the history
上传学习代码
  • Loading branch information
dankami committed Oct 8, 2016
1 parent ac26e54 commit 824a8b8
Show file tree
Hide file tree
Showing 42 changed files with 914 additions and 0 deletions.
Binary file added StudyCpp.sdf
Binary file not shown.
22 changes: 22 additions & 0 deletions StudyCpp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StudyCpp", "StudyCpp\StudyCpp.vcxproj", "{44488355-C636-4788-AD31-5EA3BDE1568C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{44488355-C636-4788-AD31-5EA3BDE1568C}.Debug|Win32.ActiveCfg = Debug|Win32
{44488355-C636-4788-AD31-5EA3BDE1568C}.Debug|Win32.Build.0 = Debug|Win32
{44488355-C636-4788-AD31-5EA3BDE1568C}.Release|Win32.ActiveCfg = Release|Win32
{44488355-C636-4788-AD31-5EA3BDE1568C}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added StudyCpp.suo
Binary file not shown.
Binary file added StudyCpp.v12.suo
Binary file not shown.
Binary file added StudyCpp/Debug/Dm01.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm02_构造函数.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm03_成员函数.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm04_重载运算符.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm05_继承中成员访问权.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm06_继承中指针引用.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm07_多态.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm08_调用动态库.obj
Binary file not shown.
Binary file not shown.
Binary file added StudyCpp/Debug/Dm10_字符串之间的判断.obj
Binary file not shown.
Binary file added StudyCpp/Debug/Dm11_string类型转int.obj
Binary file not shown.
22 changes: 22 additions & 0 deletions StudyCpp/Debug/StudyCpp.Build.CppClean.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
c:\users\xuan\documents\github\studycpp\studycpp\debug\vc120.pdb
c:\users\xuan\documents\github\studycpp\studycpp\debug\vc120.idb
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm01.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm02_构造函数.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm03_成员函数.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm04_重载运算符.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm05_继承中成员访问权.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm06_继承中指针引用.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm07_多态.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm08_调用动态库.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm09_父类调用子类成员函数.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm10_字符串之间的判断.obj
c:\users\xuan\documents\github\studycpp\studycpp\debug\dm11_string类型转int.obj
c:\users\xuan\documents\github\studycpp\debug\studycpp.ilk
c:\users\xuan\documents\github\studycpp\debug\studycpp.exe
c:\users\xuan\documents\github\studycpp\debug\studycpp.pdb
c:\users\xuan\documents\github\studycpp\studycpp\debug\studycpp.tlog\cl.command.1.tlog
c:\users\xuan\documents\github\studycpp\studycpp\debug\studycpp.tlog\cl.read.1.tlog
c:\users\xuan\documents\github\studycpp\studycpp\debug\studycpp.tlog\cl.write.1.tlog
c:\users\xuan\documents\github\studycpp\studycpp\debug\studycpp.tlog\link.command.1.tlog
c:\users\xuan\documents\github\studycpp\studycpp\debug\studycpp.tlog\link.read.1.tlog
c:\users\xuan\documents\github\studycpp\studycpp\debug\studycpp.tlog\link.write.1.tlog
34 changes: 34 additions & 0 deletions StudyCpp/Debug/StudyCpp.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
生成启动时间为 2016/10/8 22:44:36。
1>项目“C:\Users\xuan\Documents\GitHub\StudyCpp\StudyCpp\StudyCpp.vcxproj”在节点 2 上(Rebuild 个目标)。
1>ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt Dm01.cpp "Dm02_构造函数.cpp" "Dm03_成员函数.cpp" "Dm04_重载运算符.cpp" "Dm05_继承中成员访问权.cpp" "Dm06_继承中指针引用.cpp" "Dm07_多态.cpp" "Dm08_调用动态库.cpp" "Dm09_父类调用子类成员函数.cpp" "Dm10_字符串之间的判断.cpp" "Dm11_string类型转int.cpp"
Dm11_string类型转int.cpp
Dm10_字符串之间的判断.cpp
Dm09_父类调用子类成员函数.cpp
Dm08_调用动态库.cpp
Dm07_多态.cpp
Dm06_继承中指针引用.cpp
Dm05_继承中成员访问权.cpp
Dm04_重载运算符.cpp
Dm03_成员函数.cpp
Dm02_构造函数.cpp
Dm01.cpp
正在生成代码...
Link:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\xuan\Documents\GitHub\StudyCpp\Debug\StudyCpp.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\xuan\Documents\GitHub\StudyCpp\Debug\StudyCpp.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\xuan\Documents\GitHub\StudyCpp\Debug\StudyCpp.lib" /MACHINE:X86 Debug\Dm01.obj
"Debug\Dm02_构造函数.obj"
"Debug\Dm03_成员函数.obj"
"Debug\Dm04_重载运算符.obj"
"Debug\Dm05_继承中成员访问权.obj"
"Debug\Dm06_继承中指针引用.obj"
"Debug\Dm07_多态.obj"
"Debug\Dm08_调用动态库.obj"
"Debug\Dm09_父类调用子类成员函数.obj"
"Debug\Dm10_字符串之间的判断.obj"
"Debug\Dm11_string类型转int.obj"
StudyCpp.vcxproj -> C:\Users\xuan\Documents\GitHub\StudyCpp\Debug\StudyCpp.exe
1>已完成生成项目“C:\Users\xuan\Documents\GitHub\StudyCpp\StudyCpp\StudyCpp.vcxproj”(Rebuild 个目标)的操作。

生成成功。

已用时间 00:00:02.52
Binary file added StudyCpp/Debug/StudyCpp.tlog/CL.read.1.tlog
Binary file not shown.
Binary file added StudyCpp/Debug/StudyCpp.tlog/CL.write.1.tlog
Binary file not shown.
2 changes: 2 additions & 0 deletions StudyCpp/Debug/StudyCpp.tlog/StudyCpp.lastbuildstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v120:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit
Debug|Win32|C:\Users\xuan\Documents\GitHub\StudyCpp\|
Binary file added StudyCpp/Debug/StudyCpp.tlog/cl.command.1.tlog
Binary file not shown.
Binary file added StudyCpp/Debug/StudyCpp.tlog/link.command.1.tlog
Binary file not shown.
Binary file added StudyCpp/Debug/StudyCpp.tlog/link.read.1.tlog
Binary file not shown.
Binary file added StudyCpp/Debug/StudyCpp.tlog/link.write.1.tlog
Binary file not shown.
Binary file added StudyCpp/Debug/vc120.idb
Binary file not shown.
Binary file added StudyCpp/Debug/vc120.pdb
Binary file not shown.
150 changes: 150 additions & 0 deletions StudyCpp/Dm01.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
//#include <iostream>
//
//using namespace std;

// ----- 第一个例子 ------------
//int main()
//{
// cout << "hello world !!" << endl;
// system("pause");
//}

// -------- C++ 对 const 的加强 -------

//int main()
//{
// const int a = 10;
// int *p;
// p = NULL;
// p = (int *)&a; //强转为指针
// *p = 5; //C语言此处会修改了a的值,但是C++不会,因为a的值被放在符号表里,*p修改的是内寸分配的值
// cout << "a = " << a << endl;
// cout << "*p = " << *p << endl;
//
// system("pause");
//}


//------------ 引用的方便之处 ---------------

//struct Student
//{
// int age;
// int sex;
//};
//
//// 思路是通过传入stu1指针的指针,来修改stu1的指针
//void getStudent(Student **p) //传进来是指针的指针,所以p还是一个形参,但是*p(是指向stu1的指针)的修改其实是修改stu1的指针
//{
// Student *temp = NULL;
// temp = (Student *)malloc(sizeof(Student));
// temp->age = 10;
// temp->sex = 1;
// *p = temp; //stu1的指针被改为temp
//}
//
//// 思路是传入指针的引用,这样可以直接修改指针
//void getStudent2(Student* &p)
//{
// p = (Student*)malloc(sizeof(Student));
// p->age = 20;
// p->sex = 0;
//}
//
//int main()
//{
// Student *stu1 = NULL;
// //Student stu1;
// //getStudent(&stu1);
// getStudent2(stu1);
// cout << "stu1->age = " << stu1->age << endl;
// cout << "stu1->sex = " << stu1->sex << endl;
// system("pause");
//}



// ---------- 默认参数测试 -------------

//void set(int a, int b, int c=3)
//{
// cout << "a = " << a << endl;
// cout << "b = " << b << endl;
// cout << "c = " << c << endl;
//}
//
//// 默认参数必须是最右边有默认参数
////void set2(int a = 1, int b)
////{
////
////}
//
//int main()
//{
// set(1,1);
// system("pause");
//
// return 0;
//}


// --------- C++ 字符串的 测试 ---------------

//void changeChar(char* &p)
//{
// p = "123456789";
//}
//
//int main()
//{
// char str[90] = "sdlfjsldfjsdflk";
// changeChar(&str);
// cout << str << endl;
//
// system("pause");
// return 0;
//}


// --- 返回引用的测试 ----
//class Test
//{
//private:
// int a;
// int b;
//public:
// Test(int a = 0, int b = 0)
// {
// this->a = a;
// this->b = b;
// }
//
// void doAdd()
// {
// this->a++;
// this->b++;
// }
//
// void printCom()
// {
// cout << "a = " << this->a << endl;
// cout << "b = " << this->b << endl;
// }
//};
//
//Test& doAdd(Test &t) // 此处返回引用,就是传进来的参数
//{
// t.doAdd();
// return t;
//}
//
//int main()
//{
// Test t1(1, 1);
// doAdd(t1);
// t1.printCom();
// t1.doAdd();
// t1.printCom();
//
// system("pause");
//}
152 changes: 152 additions & 0 deletions StudyCpp/Dm02_构造函数.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#include <iostream>

using namespace std;


//class MyClass
//{
//private:
// int m_a;
// int m_b;
//public:
// MyClass()
// {
// m_a = 3;
// m_b = 3;
// }
// ~MyClass()
// {
//
// }
//
// MyClass(int a)
// {
// m_a = a;
// m_b = a;
// }
//
// MyClass(int a, int b)
// {
// m_a = a;
// m_b = b;
// }
//
// // 手动修改 拷贝构造函数
// MyClass(const MyClass &c)
// {
// m_a = c.m_a;
// m_b = c.m_b;
// }
//
// void setA(int a)
// {
// m_a = a;
// }
// void setB(int b)
// {
// m_b = b;
// }
//
// void p()
// {
// cout << "m_a = " << m_a << endl;
// cout << "m_b = " << m_b << endl;
// }
//};


// ------ 构造函数使用 ------
//int main()
//{
// MyClass c; //默认构造函数
// cout << "hello" << endl;
// MyClass c1 = (4, 3);
// // 1. 逗号运算符返回最后一个值,这里(4, 3)返回3
// // 2. 等号增强,这里相当于调用一个值的构造方法 MyClass(3)
//
// MyClass c2; // 这里默认调用MyClass()
// MyClass c3(); // 没有调用构造函数
//
// MyClass c4 = MyClass(3) // 生成匿名对象;
// system("pause");
//}

// ----- 拷贝构造函数 ----------
//int main()
//{
// MyClass c1;
// cout << "c1 值" << endl;
// c1.p();
// cout << "c1 改值" << endl;
// c1.setA(11);
// c1.p();
//
// MyClass c2 = c1; // 默认调用 拷贝构造函数
//
// cout << "MyClass c2 = c1; c1给c2赋值初使化 c2 值" << endl;
// c2.p();
// cout << "c2 改值" << endl;
// c2.setA(12);
// c2.p();
// cout << "c1 值不受影响,为两个变量" << endl;
// c1.p();
//
// MyClass c3;
// c3 = c2; // 把 c3成员变量的值 赋给了 c2成员变量
// cout << "c3 = c2; 只是赋值" << endl;
// c3.p();
// cout << "c3 改值" << endl;
// c3.setA(13);
// c3.p();
// cout << "c2 值" << endl;
// c2.p();
//
// system("pause");
//}


// ---- 构造函数初使化列表 ----
//class Test1
//{
//public:
// Test1()
// {
//
// }
// Test1(int a)
// {
// this->a = a;
// }
// ~Test1()
// {
//
// }
//
//private:
// int a;
//};
//
//class Test2
//{
//private:
// int a;
// int b;
// Test1 t1;
//public:
// Test2(int a , int b , int c ) : t1(c) // 调用Test1(int a)构造方法
// {
// this->a = a;
// this->b = b;
// }
// Test2(int a, int b) // 默认调用Test1()构造方法
// {
//
// }
//};
//
//int main()
//{
// Test2 t2(1, 1);
//
// system("pause");
//}
Loading

0 comments on commit 824a8b8

Please sign in to comment.