Skip to content

Commit 221a9ea

Browse files
Add files via upload
1 parent c1d9589 commit 221a9ea

31 files changed

+612
-0
lines changed

Diff for: AP-HW5/Q1/Q1/Debug/Q1.exe

108 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Debug/Q1.ilk

720 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Debug/Q1.pdb

996 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1.sln

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.16
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Q1", "Q1\Q1.vcxproj", "{3787F4B1-09AE-49F0-BE27-45E720DF068F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Debug|x64.ActiveCfg = Debug|x64
17+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Debug|x64.Build.0 = Debug|x64
18+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Debug|x86.ActiveCfg = Debug|Win32
19+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Debug|x86.Build.0 = Debug|Win32
20+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Release|x64.ActiveCfg = Release|x64
21+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Release|x64.Build.0 = Release|x64
22+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Release|x86.ActiveCfg = Release|Win32
23+
{3787F4B1-09AE-49F0-BE27-45E720DF068F}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.log

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
 main.cpp
2+
Q1.vcxproj -> C:\Users\SOS\Desktop\sixth term\AP\hws\HW5\AP-HW5-9523039\Q1\Q1\Debug\Q1.exe
3+
Q1.vcxproj -> C:\Users\SOS\Desktop\sixth term\AP\hws\HW5\AP-HW5-9523039\Q1\Q1\Debug\Q1.pdb (Partial PDB)

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/CL.command.1.tlog

778 Bytes
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/CL.read.1.tlog

18.3 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/CL.write.1.tlog

660 Bytes
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/Q1.lastbuildstate

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.15063.0
2+
Debug|Win32|C:\Users\SOS\Desktop\sixth term\AP\hws\HW5\AP-HW5-9523039\Q1\Q1\|

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/link.command.1.tlog

1.32 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/link.read.1.tlog

3.34 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/Q1.tlog/link.write.1.tlog

638 Bytes
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/main.obj

397 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/main.obj.enc

219 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/vc141.idb

331 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Debug/vc141.pdb

388 KB
Binary file not shown.

Diff for: AP-HW5/Q1/Q1/Q1/Q1.vcxproj

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{3787F4B1-09AE-49F0-BE27-45E720DF068F}</ProjectGuid>
24+
<Keyword>Win32Proj</Keyword>
25+
<RootNamespace>Q1</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v141</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v141</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v141</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v141</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<LinkIncremental>true</LinkIncremental>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
77+
<LinkIncremental>true</LinkIncremental>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
80+
<LinkIncremental>false</LinkIncremental>
81+
</PropertyGroup>
82+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
83+
<LinkIncremental>false</LinkIncremental>
84+
</PropertyGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86+
<ClCompile>
87+
<PrecompiledHeader>
88+
</PrecompiledHeader>
89+
<WarningLevel>Level3</WarningLevel>
90+
<Optimization>Disabled</Optimization>
91+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
</ClCompile>
93+
<Link>
94+
<SubSystem>Console</SubSystem>
95+
</Link>
96+
</ItemDefinitionGroup>
97+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
98+
<ClCompile>
99+
<PrecompiledHeader>
100+
</PrecompiledHeader>
101+
<WarningLevel>Level3</WarningLevel>
102+
<Optimization>Disabled</Optimization>
103+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
104+
</ClCompile>
105+
<Link>
106+
<SubSystem>Console</SubSystem>
107+
</Link>
108+
</ItemDefinitionGroup>
109+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
110+
<ClCompile>
111+
<WarningLevel>Level3</WarningLevel>
112+
<PrecompiledHeader>
113+
</PrecompiledHeader>
114+
<Optimization>MaxSpeed</Optimization>
115+
<FunctionLevelLinking>true</FunctionLevelLinking>
116+
<IntrinsicFunctions>true</IntrinsicFunctions>
117+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
118+
</ClCompile>
119+
<Link>
120+
<SubSystem>Console</SubSystem>
121+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
122+
<OptimizeReferences>true</OptimizeReferences>
123+
</Link>
124+
</ItemDefinitionGroup>
125+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
126+
<ClCompile>
127+
<WarningLevel>Level3</WarningLevel>
128+
<PrecompiledHeader>
129+
</PrecompiledHeader>
130+
<Optimization>MaxSpeed</Optimization>
131+
<FunctionLevelLinking>true</FunctionLevelLinking>
132+
<IntrinsicFunctions>true</IntrinsicFunctions>
133+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
134+
</ClCompile>
135+
<Link>
136+
<SubSystem>Console</SubSystem>
137+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
138+
<OptimizeReferences>true</OptimizeReferences>
139+
</Link>
140+
</ItemDefinitionGroup>
141+
<ItemGroup>
142+
<ClCompile Include="main.cpp" />
143+
</ItemGroup>
144+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
145+
<ImportGroup Label="ExtensionTargets">
146+
</ImportGroup>
147+
</Project>

Diff for: AP-HW5/Q1/Q1/Q1/Q1.vcxproj.filters

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="main.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>

Diff for: AP-HW5/Q1/Q1/Q1/main.cpp

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#include <iostream>
2+
#include <vector>
3+
#include <algorithm>
4+
//two initialize vec1
5+
int func() {
6+
static int n = 0;
7+
n++;
8+
return n;
9+
}
10+
//two initialize vec2
11+
int func1() {
12+
static int n = 0;
13+
n++;
14+
return n;
15+
}
16+
//to print
17+
void myfuction(int a) { std::cout << a << " "; }
18+
19+
int main() {
20+
//part A
21+
std::vector<int> vec1(100);
22+
std::generate(vec1.begin(), vec1.end(), func );
23+
std::cout << "vec1 is:" << "\n";
24+
std::for_each(begin(vec1), end(vec1), myfuction);
25+
std::cout <<"\n" <<std::endl;
26+
27+
std::vector<int> vec2(10);
28+
std::generate(vec2.begin(), vec2.end(), func1);
29+
std::cout << "vec2 is:" << "\n";
30+
std::for_each(begin(vec2), end(vec2), myfuction);
31+
std::cout << "\n" << std::endl;
32+
//part B
33+
std::copy(vec1.begin(), vec1.end(), std::back_inserter(vec2));
34+
std::cout << "Part B" << "\n";
35+
std::for_each(begin(vec2), end(vec2), myfuction);
36+
std::cout << "\n" << std::endl;
37+
38+
//part C
39+
std::vector<int> odd_vec(50);
40+
std::copy_if(vec1.begin(), vec1.end(), odd_vec.begin(), [](int i) {return i % 2 != 0; });
41+
std::cout << "Odd_vec is:" << "\n";
42+
std::for_each(begin(odd_vec), end(odd_vec), myfuction);
43+
std::cout << "\n" << std::endl;
44+
45+
//part D
46+
std::vector<int> reverse_vec(vec1.rbegin(),vec1.rend());
47+
std::cout << "Reverse vector:" << "\n";
48+
49+
std::for_each(begin(reverse_vec), end(reverse_vec), myfuction);
50+
std::cout << "\n" << std::endl;
51+
//part D
52+
//save vec2 to parallel sorting
53+
std::vector<int> temp_vec(110);
54+
std::copy(begin(vec2), end(vec2), begin(temp_vec));
55+
std::cout << "Normal Sort:" << "\n";
56+
57+
std::sort(begin(vec2), end(vec2));
58+
std::for_each(begin(vec2), end(vec2), myfuction);
59+
std::cout << "\n" << std::endl;
60+
61+
//std::sort(std::execution::par_unseq, temp_vec.begin(), temp_vec.end());
62+
}

Diff for: AP-HW5/Q3/main.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
A0 = dict(zip(('a','b','c','d','e'),('1','2','3','4','5')))
3+
A1 = range(10)
4+
A2 = [i for i in A1 if i in A0]
5+
A3 = sorted(A0[i] for i in A0)
6+
A4 = [[i,i*i] for i in A1]
7+
8+
funcs = []
9+
for key in globals().copy():
10+
if key.startswith('A'):
11+
funcs.append(key)
12+
for func in funcs:
13+
print('{} is: {}' .format(func,globals()[func]))

Diff for: AP-HW5/Q4/main.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import random
2+
import math
3+
import
4+
def IsInCircle(x,y):
5+
if (x**2 + y**2) <=1:
6+
return 1
7+
return 0
8+
9+
count=1
10+
11+
def find():
12+
num=0
13+
count=1
14+
while abs(math.pi-(4*num/count)) >.01:
15+
count+=1
16+
num=0
17+
a=[(random.uniform(0,1),random.uniform(0,1)) for _ in range(count)]
18+
for i in range(count):
19+
num+=IsInCircle(a[i][0],a[i][1])
20+
if abs(math.pi-(4*num/count)) <.01:
21+
print('count: {} and {} '.format(count, 4 * num / count))
22+
return [4 * num / count,count]
23+
24+
25+
rank = input("How many times have you gotten the program?")
26+
b=0
27+
for i in range(int(rank)):
28+
f,c=find()
29+
b+=f
30+
b=b/int(rank)
31+
print(f'The Resualt Of Estimation Pi: {b}')

Diff for: AP-HW5/Q5/main.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import os
2+
str = input("what is your command:")
3+
func,name = str.split('(')
4+
name,address = name.split(',')
5+
address,four = address.split(')')
6+
7+
8+
9+
def create_dir(name,address):
10+
#print(f'{name} {address}')
11+
os.mkdir(address+'\\'+name)
12+
13+
def create_file(name,address):
14+
f = open(address +'\\'+name , 'w')
15+
def delete(name,address):
16+
os.remove(address+'\\'+name)
17+
dir=[]
18+
def find(name,address):
19+
for root, dirs, files in os.walk(address):
20+
21+
for i in files:
22+
if i==name:
23+
#print(f'{root}')
24+
dir.append(root)
25+
print(f'{dir}')
26+
27+
28+
if func == 'create_dir':
29+
if os.path.isdir(address +'\\'+name)== False:
30+
print(os.path.isdir(address) )
31+
create_dir(name,address)
32+
33+
if func == 'create_file':
34+
#if os.path.isdir(address +'\\'+name)== False:
35+
# print(os.path.isdir(address) )
36+
create_file(name,address)
37+
38+
if func == 'delete':
39+
if os.path.isfile(address +'\\'+name)== True:
40+
delete(name,address)
41+
42+
if func == 'find':
43+
find(name, address)
44+

0 commit comments

Comments
 (0)