Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions zhangxuCaculator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.852
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "zhangxuCaculator", "zhangxuCaculator\zhangxuCaculator.csproj", "{25601255-979D-4FFA-84B8-8FF12954A0AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "zhangxuCaculatorTests", "zhangxuCaculatorTests\zhangxuCaculatorTests.csproj", "{F8441009-B59A-4EE4-B7E9-447B814C4F53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25601255-979D-4FFA-84B8-8FF12954A0AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25601255-979D-4FFA-84B8-8FF12954A0AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25601255-979D-4FFA-84B8-8FF12954A0AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25601255-979D-4FFA-84B8-8FF12954A0AE}.Release|Any CPU.Build.0 = Release|Any CPU
{F8441009-B59A-4EE4-B7E9-447B814C4F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8441009-B59A-4EE4-B7E9-447B814C4F53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8441009-B59A-4EE4-B7E9-447B814C4F53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8441009-B59A-4EE4-B7E9-447B814C4F53}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {812C50B8-1020-4578-8477-75C33F7AF05E}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions zhangxuCaculator/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
79 changes: 79 additions & 0 deletions zhangxuCaculator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data;

namespace zhangxu_Caculator
{
public class Caculator
{
public static char[] symbol = { '+', '-', '*', '/' };
public static string Profunc()
{
String func = null;
Random numsyb = new Random(Guid.NewGuid().GetHashCode());
int num = numsyb.Next(1, 101);
int j, i, s, k;
func = func + num;
j = numsyb.Next(1, 3);
for (i = 0; i <= j; i++)
{
k = numsyb.Next(1, 101);
s = numsyb.Next(0, 4);
func = func + symbol[s] + k;
}
return func;
}

public static string Compute(string func)
{
string aws = null;
DataTable m = new DataTable();
aws = m.Compute(func, null).ToString();
if (double.Parse(aws) % 1 != 0)
{
return null;
}
return aws;
}

public static void Xuwrite(string aws)
{


StreamWriter sw = new StreamWriter("C:\\Users\\MagicBook\\Desktop\\xu.txt", true, System.Text.Encoding.Default);
sw.WriteLine(aws);
sw.Close();
}


static void Main(string[] args)
{
int n;
string m = null;
Console.Write("输入个数:");
n = int.Parse(Console.ReadLine());
int i = 0;
while (i < n)
{
string func = Profunc();
string aws = Compute(func);
i++;
if (aws == null)
{
i--;
continue;
}
Console.WriteLine(func + "=" + aws);
m = func + "=" + aws;
Xuwrite(m);
}
Console.ReadLine();
}
}
}


36 changes: 36 additions & 0 deletions zhangxuCaculator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("zhangxuCaculator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("zhangxuCaculator")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("25601255-979d-4ffa-84b8-8ff12954a0ae")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file not shown.
6 changes: 6 additions & 0 deletions zhangxuCaculator/bin/Debug/zhangxuCaculator.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
Binary file added zhangxuCaculator/bin/Debug/zhangxuCaculator.pdb
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
83a7d317ce33cb542ec9fc88df6755e399b3253d
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\bin\Debug\zhangxuCaculator.exe.config
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\bin\Debug\zhangxuCaculator.exe
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\bin\Debug\zhangxuCaculator.pdb
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\obj\Debug\zhangxuCaculator.csprojAssemblyReference.cache
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\obj\Debug\zhangxuCaculator.csproj.CoreCompileInputs.cache
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\obj\Debug\zhangxuCaculator.exe
C:\Users\MagicBook\Desktop\zhangxuCaculator\zhangxuCaculator\obj\Debug\zhangxuCaculator.pdb
Binary file not shown.
Binary file not shown.
Binary file added zhangxuCaculator/obj/Debug/zhangxuCaculator.pdb
Binary file not shown.
53 changes: 53 additions & 0 deletions zhangxuCaculator/zhangxuCaculator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{25601255-979D-4FFA-84B8-8FF12954A0AE}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>zhangxuCaculator</RootNamespace>
<AssemblyName>zhangxuCaculator</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
20 changes: 20 additions & 0 deletions zhangxuCaculatorTests/CaculatorTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using zhangxu_Caculator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace zhangxu_Caculator.Tests
{
[TestClass()]
public class CaculatorTests
{
[TestMethod()]
public void ProfuncTest()
{
Assert.AreEqual(Caculator.symbol[1], '-');
}
}
}
36 changes: 36 additions & 0 deletions zhangxuCaculatorTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("zhangxuCaculatorTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("zhangxuCaculatorTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f8441009-b59a-4ee4-b7e9-447b814c4f53")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c4119dfb9c4da4b50706ece28a27716af5f4c5f7
Binary file not shown.
5 changes: 5 additions & 0 deletions zhangxuCaculatorTests/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net461" />
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net461" />
</packages>
Loading