This commit is contained in:
2018-06-17 14:30:24 +08:00
parent bbc06c4132
commit cfceb31582
8 changed files with 235 additions and 160 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/main.cpp" charset="GB2312" />
<file url="file://$PROJECT_DIR$/main.cpp" charset="UTF-8" />
</component>
</project>

View File

@@ -22,7 +22,7 @@
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
<component name="FileEditorManager">
<leaf>
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor" />
@@ -31,25 +31,16 @@
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2793">
<caret line="176" column="28" lean-forward="true" selection-start-line="176" selection-start-column="28" selection-end-line="176" selection-end-column="28" />
<state relative-caret-position="443">
<caret line="189" column="17" lean-forward="true" selection-start-line="189" selection-start-column="17" selection-end-line="189" selection-end-column="17" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<element signature="e#5243#5258#0" expanded="true" />
<element signature="e#5259#5274#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="stl_list.h" pinned="false" current-in-tab="false">
<entry file="file://C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/bits/stl_list.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="116">
<caret line="152" selection-start-line="152" selection-end-line="152" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
@@ -90,6 +81,7 @@
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../sort" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
@@ -124,33 +116,34 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1527916067325</updated>
<workItem from="1527916069365" duration="16288000" />
<workItem from="1527916069365" duration="16345000" />
<workItem from="1527989312366" duration="3718000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="16288000" />
<option name="totallyTimeSpent" value="20063000" />
</component>
<component name="ToolWindowManager">
<frame x="-6" y="-6" width="1381" height="885" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24945135" />
<window_info content_ui="combo" id="Project" order="0" weight="0.37431395" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Messages" weight="0.61837" />
<window_info anchor="bottom" id="CMake" />
<window_info anchor="bottom" id="Event Log" side_tool="true" />
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
<window_info anchor="bottom" id="CMake" order="7" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Run" order="2" weight="0.49029756" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Terminal" />
<window_info id="Favorites" side_tool="true" />
<window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.25355756" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.79560155" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Messages" order="7" weight="0.61837" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Message" order="0" />
</layout>
@@ -204,18 +197,39 @@
</entry>
<entry file="file://C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/bits/stl_list.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="116">
<state relative-caret-position="4408">
<caret line="152" selection-start-line="152" selection-end-line="152" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2793">
<state relative-caret-position="5104">
<caret line="176" column="28" lean-forward="true" selection-start-line="176" selection-start-column="28" selection-end-line="176" selection-end-column="28" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<element signature="e#5243#5258#0" expanded="true" />
<element signature="e#5259#5274#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/bits/stl_list.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4408">
<caret line="152" selection-start-line="152" selection-end-line="152" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="443">
<caret line="189" column="17" lean-forward="true" selection-start-line="189" selection-start-column="17" selection-end-line="189" selection-end-column="17" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<element signature="e#5259#5274#0" expanded="true" />
</folding>
</state>
</provider>

BIN
png/a.out

Binary file not shown.

View File

@@ -188,18 +188,18 @@ using namespace std;
int main(){
list<Polynomial> a;
while (true){
cout << "<EFBFBD><EFBFBD>ǰ<EFBFBD>ݴ<EFBFBD><EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" <<endl;
cout << "当前暂存的函数有:" <<endl;
for(const auto &item : a){
cout << item <<endl;
}
cout << "<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>:"<<endl;
cout << "1. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĶ<EFBFBD><EFBFBD><EFBFBD>ʽ" <<endl;
cout << "2. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ӷ<EFBFBD>" << endl;
cout << "3. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <<endl;
cout << "4. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>˷<EFBFBD>" <<endl;
cout << "5. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" << endl;
cout << "6. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ" << endl;
cout << "0. <EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <<endl;
cout << "请选择下面的操作:"<<endl;
cout << "1. 创建新的多项式" <<endl;
cout << "2. 多项式加法" << endl;
cout << "3. 多项式减法" <<endl;
cout << "4. 多项式乘法" <<endl;
cout << "5. 多项式求导" << endl;
cout << "6. 多项式带入求值" << endl;
cout << "0. 退出程序" <<endl;
int check;
cin >> check;
auto* name = new char[20];
@@ -210,11 +210,11 @@ int main(){
list<Polynomial>::iterator itb,itc;
switch (check){
case 1:
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "多项式名称:";
cin >> name;
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "请输入项数:";
cin >> num;
cout << "<EFBFBD><EFBFBD>մ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ָ<><D6B8> <20><> ϵ<><CFB5>"<< endl;
cout << "请按照次数从小到大的顺序输入 指数 和 系数"<< endl;
for(int i = 0;i<num;i++){
cin >> ex >> co;
end->expn = ex;
@@ -224,20 +224,20 @@ int main(){
}
deletLastOne(head);
a.emplace_back(head,name);
cout << endl << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ʽΪ:"<<endl;
cout << endl << "输入结束,您输入的表达式为:"<<endl;
cout << a.back() << endl;
break;
case 2:
case 3:
case 4:
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "请输入结果多项式的名称:";
cin >> name;
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ո<EFBFBD><D5B8>ָ<EFBFBD>:";
cout << "请输入两个运算多项式的名称 空格分隔:";
cin >> c >> b;
itc = find(a.begin(),a.end(),c);
itb = find(a.begin(),a.end(),b);
if(itc == a.end() || itb == a.end()){
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
cout << "输入的名字有误";
}else{
switch (check){
case 2:
@@ -251,34 +251,34 @@ int main(){
break;
default:break;
}
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>õ<EFBFBD><C3B5>ı<EFBFBD><C4B1><EFBFBD>ʽΪ:"<<endl;
cout << "输入结束,得到的表达式为:"<<endl;
cout << a.back() << endl;
}
break;
case 5:
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "请输入结果多项式的名称:";
cin >> name;
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "请输入需要计算的多项式名称:";
cin >> b;
itb = find(a.begin(),a.end(),b);
if(itb == a.end()){
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
cout << "输入的名字有误";
} else{
a.emplace_back((*itb).derivative(),name);
cout <<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>õ<EFBFBD><C3B5>ı<EFBFBD><C4B1><EFBFBD>ʽΪ:"<<endl;
cout <<"输入结束,得到的表达式为:"<<endl;
cout << a.back() << endl;
}
break;
case 6:
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "请输入多项式的名称:";
cin >> name;
itb = find(a.begin(),a.end(),name);
if(itb == a.end()){
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
cout << "输入的名字有误";
} else{
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "请输入参数:";
cin >> co;
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:";
cout << "计算结果:";
cout << (*itb)(co) << endl;
}
break;