C++课程设计报告 下载本文

内容发布更新时间 : 2024/11/20 2:43:59星期一 下面是文章的全部内容请认真阅读。

judge jud; jud.ShowDialog(); } private: System::Void button_manageMyMessage_Click(System::Object^ sender, System::EventArgs^ e) { myMessage my; my.ShowDialog(); }

private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) { this->Close(); }

private: System::Void button_manageOrder_Click(System::Object^ sender, System::EventArgs^ e) { ifstream input(\ string name; input>>name; input.close(); int i=4; while(i--) //删|?除y后¨?四?个?元a素?(ê?§.txt)ê? { name.erase((--name.end())); } name+=\ ifstream input2(name); string tmp; input2>>tmp; bool have = 1; if(tmp==\ input2.close(); if(have) { order_manage o; o.ShowDialog(); } else{ noOrder no; no.ShowDialog(); } }

private: System::Void button_submit_Click(System::Object^ sender, System::EventArgs^ e) { String^ t1 = comboBox1->Text;

20

String^ t2 = comboBox2->Text; String^ t3 = comboBox3->Text; String^ t4 = comboBox4->Text; String^ t5 = comboBox5->Text; String^ t6 = comboBox6->Text; String^ t7 = comboBox7->Text; String^ t8 = comboBox8->Text; String^ t9 = comboBox9->Text; String^ t10 = comboBox10->Text; int num2[11]; //表à¨a示o?每?份¤Y菜?有?D多¨¤少|¨′份¤Y的ì?数oy组á¨| //下?面?是o?System::String^ 与?? std::string的ì?转áa换? if(t1==\ //判D断?是o?不?是o?为a空?,ê?防¤¨¤止1出?现?异°¨?常?ê else num2[1]=int::Parse(t1); if(t2==\ else num2[2]=int::Parse(t2); if(t3==\ else num2[3]=int::Parse(t3); if(t4==\ else num2[4]=int::Parse(t4); if(t5==\ else num2[5]=int::Parse(t5); if(t6==\ else num2[6]=int::Parse(t6); if(t7==\ else num2[7]=int::Parse(t7); if(t8==\ else num2[8]=int::Parse(t8); if(t9==\ else num2[9]=int::Parse(t9); if(t10==\ else num2[10]=int::Parse(t10); double price[]={0,9,5,39,66,79,99,69,19,39,29};//表à¨a示o?每?份¤Y菜?多¨¤少|¨′钱?的ì?数oy组á¨| double sum_price = 0; for(int i=1;i<11;i++){ sum_price += num2[i]*price[i]; } const string dish_names[]={\西??红¨?柿o¨¢炒??鸡|蛋ì?? 9.00\酸¨¢辣¤?à

21

土a¨¢豆1丝? 5.00\大?¨?酱??汤?¨¤ 39.00\蒸?排?骨? 66.00\糖??醋??á鲤¤e鱼?? 79.00\ \糖??醋??á排?骨? 99.00\白??á芍|?虾o 69.00\鸡|汤?¨¤馄?饨? 19.00\一°?品?¤豆1腐?¥ 39.00\鸡|蛋ì??布?丁? 29.00\ static int cnt = 1; ifstream input1(\ //写??入¨?信?息?é string name; input1>>name; input1.close(); int i=4; while(i--) //删|?除y后¨?四?个?元a素?(ê?§.txt)ê? { name.erase((--name.end())); } name+=\ ifstream input2(name); string s; input2>>s; bool have = 1; if(s==\ input2.close(); if(!have) { ofstream output(name); for(int i=1;i<11;i++){ if(num2[i]){ output<Close(); return; } cnt++; ifstream input(\ string name2;

22

input>>name2; input.close(); ofstream output(name2,ios::app); for(int i=1;i<11;i++){ if(num2[i]){ output<Close(); }

private: System::Void pay_Load(System::Object^ sender, System::EventArgs^ e) { ifstream input(\ //写??入¨?信?息?é string name; input>>name; input.close(); int i=4; while(i--) //删|?除y后¨?四?个?元a素?(ê?§.txt)ê? { name.erase((--name.end())); } name+=\ ifstream input1(name); string temp,temp2; while(input1>>temp){ input1>>temp2; string temp3 = temp+temp2; String^ str = gcnew String(temp3.c_str()); //std::string -> System::String^ listBox1->Items->Add(str); } input1.close(); } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { ToPay topay ; topay.ShowDialog(); ifstream input(\ //写??入¨?信?息?é string name;

23

input>>name; input.close(); int i=4; while(i--) //删|?除y后¨?四?个?元a素?(ê?§.txt)ê? { name.erase((--name.end())); } name+=\ ofstream output(name); output<<\ output.close(); this->Close(); }

private: System::Void order_manage_Load(System::Object^ sender, System::EventArgs^ e) { ifstream input(\ string name; input>>name; input.close(); int i=4; while(i--) //删|?除y后¨?四?个?元a素?(ê?§.txt)ê? { name.erase((--name.end())); } name+=\ const string dish_names[]={\西??红¨?柿o¨¢炒??鸡|蛋ì?? 9.00\酸¨¢辣¤?à土a¨¢豆1丝? 5.00\大?¨?酱??汤?¨¤ 39.00\蒸?排?骨? 66.00\糖??醋??á鲤¤e鱼?? 79.00\ \糖??醋??á排?骨? 99.00\白??á芍|?虾o 69.00\鸡|汤?¨¤馄?饨? 19.00\一°?品?¤豆1腐?¥ 39.00\鸡|蛋ì??布?丁? 29.00\ map mp; for(int i=1;i<11;i++){ mp[dish_names[i]]=0; } ifstream input2(name); string tmp,tmp2; while(input2>>tmp) { input2>>tmp2; if(tmp == \总á¨1计?:\ int val,j;

24