?? main.cpp
字號:
#include <iostream>
#include "SupMakt.h"
using namespace std;
int main(){
cout.setf(ios_base::fixed); // 0.00 format
cout.precision(2); // 0.00 format
cout.setf(ios_base::showpoint); // 0.00 format
int i_main = 0,
i_load = 0,
i_dele = 0,
i_sest = 0; // SELL OR STOCK
int kd = 0; // Delete by KINDNUMBER
node * tempNew;
dh();
system( "cls" );
pria(); // Load welcome screen
clear();
node *header = NULL;
i_load = pri_load();
switch(i_load) {
case 1: // Load the data last saved
header = data_load();
break;
case 2: // Not load
cout << "There is no data, so you must input data:";
header = init();
break;
case 3: // Exit
return 0;
break;
default:
cerr << " Error happened !" << endl;
}
char ch_for = '1'; // For main screen
while( ch_for != 'n' && ch_for != 'N'){
clear();
// Print the main screen information
i_main = pri();
switch(i_main){
case 1 : { // STOCK(ADD GOODS INFORMATION)
cout << "1" << endl;
if (header->next != NULL) {
tempNew = (node *)malloc(sizeof(node));
tempNew = addRec(header);
tempNew->next = header->next;
header->next = tempNew;
printf( "\n Y to save ; N to cancel :" );
//getchar();
fflush(stdin); // clear buffer
char chnlast = getchar();
if( chnlast == 'y' || chnlast == 'Y'){
data_save(header);
printf( "\n Save Success !!!" );
}
}else{
header = init();
}
}break;
case 2 : { // SELL OR STOCK(UPADTE)
cout << "2" << endl;
clear();
i_sest = sest(); // Print SELL OR STOCK's screen
switch(i_sest) {
case 1:{ // SELL PART
Sell(header);
}
break;
case 2:{ // STOCK PART
Stock(header);
}
break;
case 3:
break;
default:
cerr << " SELL OR STOCK ERROR HAPPENED !" << endl;
}
}break;
case 3 : { // DELETE GOODS INFORMATION
cout << "3" << endl;
clear();
i_dele = pridel();
switch(i_dele) {
case 1: { // DELETE ALL
if (header) {
del_all(header);
}else{
cerr << "The record is not existence!";
}
}
break;
case 2: { // DELETE BY KINDNUMBER
if (header) {
cout << "Please enter KIND NUMBER : ";
cin >> kd;
cout << endl;
deleteKind(header, kd);
}else{
cerr << "The record is not existence!";
}
}
break;
case 3:
break;
default:
cerr << " DELETE GOODS INFORMATION ERROR HAPPENED !" << endl;
break;
}
}break;
case 4 : { // QUERY GOODS INFORMATION
cout << "4" << endl;
clear();
if (header->next != NULL) {
display(header);
}else{
cerr << "There is none record !" << endl;
}
}break;
case 5 : { // SORT RECORDS
cout << "Sort by kind number :" << endl;
SortLink(header);
}break;
case 6 : { // ACCOUNT MANAGE
cout << "6" << endl;
clear();
AccountShow(header);
}break;
case 7 : { // DATA MAINTENANCE
cout << "7" << endl;
clear();
DataMaintenance(header);
}break;
case 8 : { // EXIT
cout << "8" << endl;
}break;
default:
cerr << " Error happened !" << endl;
}
cout << "To continue ... (Y/N)" << endl;
//getchar();
fflush(stdin); // clear buffer
ch_for = getchar();
}
printf( "\n Y to save ; N to cancel :" );
//getchar();
fflush(stdin); // clear buffer
char chnlast = getchar();
if( chnlast == 'y' || chnlast == 'Y'){
data_save(header);
printf( "\n Save Success !!!" );
}
freeMemory(header);
return 1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -