?? main.cpp
字號:
#include <iostream>
#include <string>
#include <cstdlib>
#include <new>
#define NULL 0
#include "add.h" //包含加法操作的類的頭文件
int main()
{
string adder1,adder2,choice;
while(1) //用無限循環來實現加法的重復操作
{
Add_operation Add_oper; //創建加法操作的類對象
cout <<"\n************************************************************" << endl;
cout << "輸入格式要求:每四位一組,組間用逗號隔開" << endl;
cout << "\nInput the first adder : ";
cin >> adder1;
cout << endl << "Input the second adder : ";
cin >> adder2;
LinkList L1=Add_oper.CreatLink(adder1);
LinkList L2=Add_oper.CreatLink(adder2);
LinkList result=Add_oper.Add(L1,L2);
Add_oper.Print(result);
Add_oper.Destroy(L1); //每次做完加法運算后都將前面分配的內存空間釋放掉,避免內存泄漏
Add_oper.Destroy(L2);
Add_oper.Destroy(result);
cout << "************************************************************\nDo add again ? y or n : ";
cin >> choice;
if(choice=="n")
break; //直到輸入n為止才結束程序
}
system("pause");
return EXIT_SUCCESS;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -