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
22 changes: 22 additions & 0 deletions 13551330961/Project3/Project3.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.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project3", "Project3\Project3.vcxproj", "{709BC269-9A0E-4E72-B6A5-EB5147F50BA6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{709BC269-9A0E-4E72-B6A5-EB5147F50BA6}.Debug|Win32.ActiveCfg = Debug|Win32
{709BC269-9A0E-4E72-B6A5-EB5147F50BA6}.Debug|Win32.Build.0 = Debug|Win32
{709BC269-9A0E-4E72-B6A5-EB5147F50BA6}.Release|Win32.ActiveCfg = Release|Win32
{709BC269-9A0E-4E72-B6A5-EB5147F50BA6}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
72 changes: 72 additions & 0 deletions 13551330961/Project3/Project3/Project3.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{709BC269-9A0E-4E72-B6A5-EB5147F50BA6}</ProjectGuid>
<RootNamespace>Project3</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="源.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
22 changes: 22 additions & 0 deletions 13551330961/Project3/Project3/Project3.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="源.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
251 changes: 251 additions & 0 deletions 13551330961/Project3/Project3/源.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
#include<iostream>
#include<time.h>
#include<windows.h>
#include <fstream>
using namespace std;
void Tot(int n);
void Toto(int n);
typedef int Status;
typedef int QElemType;//�������Ԫ����������
typedef int QElemType; //����Ԫ�ص���������
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define MAXQSIZE 100 //ѭ�������������
//ѭ����������
typedef struct QNode{
QElemType *base; //����Ԫ�ش洢����
int front; //��ͷָ�룬�����в��գ���ָ�����ͷԪ��
int rear; //��βָ�룬�����в��գ���ָ�����βԪ�ص���һ���հ�λ��
}SqQueue;

//��ʼ��ѭ������
Status InitQueue(SqQueue &q) {
q.base = (QElemType *)malloc(MAXQSIZE * sizeof(QElemType)); //����ռ�
if (!q.base) return ERROR;
//��ʼ����ͷ����β
q.front = 0;
q.rear = 0;
return OK;
}
//��ӣ�Ԫ��ֵe��ӣ�������������޷���Ӿͷ���ERROR��ִ�гɹ�����OK��
Status EnQueue(SqQueue &q, QElemType e){
if ((q.rear + 1) % MAXQSIZE == q.front)
return ERROR;
q.base[q.rear] = e;
q.rear = (q.rear + 1) % MAXQSIZE;
return OK;

}
//���δ�ӡ�������Ԫ�أ�ִ�гɹ�����OK�����򷵻�ERROR��
Status PrintQueue(SqQueue q) {
int i = q.front;
while ((i + q.front) != q.rear)
{
printf("%d ", q.base[i]);
i = (i + 1) % MAXQSIZE;
}
return OK;
}

int main()
{
int m, n;
cout << "��������Ҫ�������������������:" << endl;
cin >> n;
srand((unsigned)time(NULL));
do
{
cout << "2��ʽ���������롰2����3��ʽ���������롰3��" << endl;
cin >> m;
cout << "........���������Ŀ��........" << endl;
Sleep(1000);
cout << "..........Loading.............." << endl;
Sleep(1000);
switch (m)
{
case 2: Tot(n);
case 3: cout << "��ż�����������!�˼�����Ա��δ�������˰��...\n..........��ȴ�����.........\n";
break;
default:
cout << "\n\n�����������������������ַ���\n" << endl;
}
} while (m);

//Tot(n);
system("pause");
return 0;
}
void Tot(int n)
{

SqQueue Q;
QElemType e;
InitQueue(Q);
int i, x, y, s, m;
for (i = 0; i < n; i++)
{
s = rand() % 4 + 1;
if (s == 1)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
e = x + y;
EnQueue(Q, e);
cout << x << "+" << y << "=\n";
}
else if (s == 2)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
e = x - y;
EnQueue(Q, e);
cout << x << "-" << y << "=\n";
}
else if (s == 3)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
e = x*y;
EnQueue(Q, e);
cout << x << "��" << y << "=\n";
}
else if (s == 4)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
if (x > y)
{
if (x%y == 0)
{
e = x / y;
EnQueue(Q, e);
cout << x << "��" << y << "=\n";
}
else
{
i--;
}
}
else if (x <= y)
{
if (y%x == 0)
{
e = x / y;
EnQueue(Q, e);
cout << y << "��" << x << "=\n";
}
else
{
i--;
}
}
}

}
cout << "��ʾ�������롰1��" << endl;
do{
cin >> m;
switch (m)
{
case 1:
PrintQueue(Q);
break;
default:
cout << "\n����������";
}
} while (m);
ofstream outfile;
outfile.open("subject.txt");
cout << PrintQueue(Q) << endl;
outfile.close();


}
/*void Toto(int n)
{

SqQueue Q;
QElemType e;
InitQueue(Q);
int i, x, y, s, m, z,u;
for (i = 0; i < n; i++)
{
s = rand() % 4 + 1;
if (s == 1)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
u = rand() % 100 + 1;
e = x + y;
EnQueue(Q, e);
cout << x << "+" << y << "=\n";
}
else if (s == 2)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
u = rand() % 100 + 1;
e = x - y;
EnQueue(Q, e);
cout << x << "-" << y << "=\n";
}
else if (s == 3)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
u = rand() % 100 + 1;
e = x*y;
EnQueue(Q, e);
cout << x << "��" << y << "=\n";
}
else if (s == 4)
{
x = rand() % 100 + 1;
y = rand() % 100 + 1;
u = rand() % 100 + 1;
if (x > y)
{
if (x%y == 0)
{
e = x / y;
EnQueue(Q, e);
cout << x << "��" << y << "=\n";
}
else
{
i--;
}
}
else if (x <= y)
{
if (y%x == 0)
{
e = x / y;
EnQueue(Q, e);
cout << y << "��" << x << "=\n";
}
else
{
i--;
}
}
}

}
cout << "��ʾ�������롰1��" << endl;
do{
cin >> m;
switch (m)
{
case 1:
PrintQueue(Q);
break;
default:
cout << "\n����������";
}
} while (m);
system("pause");
}
*/