Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.11 KB | None | 0 0
  1. // financial project ans.cpp : 此檔案包含 'main' 函式。程式會於該處開始執行及結束執行。
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. #include <fstream>
  7. #include <conio.h>
  8. #include <time.h>
  9.  
  10. using namespace std;
  11.  
  12. struct USER
  13. {
  14. char name[13];
  15. char passwd[11];
  16. double cash;
  17. int login_count;
  18. int sim_datei;
  19. int hold[5];
  20. };
  21.  
  22. struct STOCK
  23. {
  24. char name[10];
  25. int count;
  26. int *date;
  27. double *open, *high, *low, *close, *adj;
  28. int *vol;
  29. };
  30.  
  31. STOCK read_stock(char name[])
  32. {
  33. STOCK s;
  34. strcpy_s(s.name, name);
  35. char filename[20];
  36. strcpy_s(filename, name);
  37. strcat_s(filename, ".csv");
  38. ifstream fin;
  39. fin.open(filename);
  40. s.count = 0;//?
  41. char temp[1000];
  42. while (!fin.eof())
  43. {
  44. fin.getline(temp, 1000);
  45. s.count++;
  46. }
  47. fin.close();
  48. s.date = new int[s.count];
  49. s.open = new double[s.count];
  50. s.high = new double[s.count];
  51. s.low = new double[s.count];
  52. s.close = new double[s.count];
  53. s.adj = new double[s.count];
  54. s.vol = new int[s.count];
  55. int i;
  56. char tmp;
  57. fin.open(filename);
  58. for (i = 0; i < s.count; i++)
  59. {
  60. fin >> s.date[i];
  61. fin >> tmp;
  62. fin >> s.open[i];
  63. fin >> tmp;
  64. fin >> s.high[i];
  65. fin >> tmp;
  66. fin >> s.low[i];
  67. fin >> tmp;
  68. fin >> s.close[i];
  69. fin >> tmp;
  70. fin >> s.adj[i];
  71. fin >> tmp;
  72. fin >> s.vol[i];
  73. }
  74. fin.close();
  75. return s;
  76. }
  77.  
  78. void delete_stock(STOCK s)
  79. {
  80. delete[] s.vol;
  81. delete[] s.adj;
  82. delete[] s.close;
  83. delete[] s.low;
  84. delete[] s.high;
  85. delete[] s.open;
  86. delete[] s.date;
  87. }
  88.  
  89. void inputName(char name[], int j)
  90. {
  91. char x;
  92. int c = 0, i;
  93. do {
  94. system("cls");
  95. if (j == 1)
  96. cout << "Username: ";
  97. else if (j == 0)
  98. cout << "Password: ";
  99. if (j == 1)
  100. {
  101. for (i = 0; i < c; i++)
  102. cout << name[i];
  103. }
  104. else if (j == 0)
  105. {
  106. for (i = 0; i < c; i++)
  107. cout << "*";
  108. }
  109. x = _getwch();
  110. if (isalnum(x))
  111. {
  112. if (c == 12 && j == 1)
  113. c--;
  114.  
  115. else if (c == 10 && j == 0)
  116. c--;
  117. name[c] = x;
  118. c++;
  119. }
  120. if (x == 8 && c > 0)//8是後退
  121. c--;
  122. } while (x != 13 || c == 0);
  123. name[c] = '\0';
  124. }
  125.  
  126.  
  127. USER login()
  128. {
  129.  
  130. char name1[13];
  131. char passwd1[11];
  132. USER userlist[1000];
  133. int userno, i, j;
  134. ifstream fin;
  135. fin.open("userlist.txt");
  136. fin >> userno;
  137. for (i = 0; i < userno; i++)
  138. {
  139. fin >> userlist[i].name;
  140. fin >> userlist[i].passwd;
  141. fin >> userlist[i].cash;
  142. fin >> userlist[i].login_count;
  143. fin >> userlist[i].sim_datei;
  144. for (j = 0; j < 5; j++)
  145. fin >> userlist[i].hold[j];
  146. }
  147. fin.close();
  148. do {
  149. system("cls");
  150. inputName(name1, 1);
  151. inputName(passwd1, 0);
  152. for (i = 0; i < userno; i++)
  153. {
  154. if (strcmp(userlist[i].name, name1) == 0)
  155. {
  156. if (strcmp(userlist[i].passwd, passwd1) == 0)
  157. {
  158. userlist[i].login_count++;
  159. return userlist[i];
  160. }
  161. else
  162. {
  163. cout << "Incorrect password!!!!!!" << endl;
  164. cout << "Press any key" << endl;
  165. _getwch();
  166. break;
  167. }
  168. }
  169. }
  170. if (i == userno)
  171. {
  172. char passwd2[11];
  173. cout << "Confirm your password: ";
  174. cin >> passwd2;
  175. if (strcmp(passwd1, passwd2) == 0)
  176. {
  177. strcpy_s(userlist[userno].name, name1);
  178. strcpy_s(userlist[userno].passwd, passwd1);
  179. userlist[userno].login_count = 1;
  180. userlist[userno].cash = 10000;
  181. userlist[userno].sim_datei = 2;
  182. userlist[userno].hold[0] = 0;
  183. userlist[userno].hold[1] = 0;
  184. userlist[userno].hold[2] = 0;
  185. userlist[userno].hold[3] = 0;
  186. userlist[userno].hold[4] = 0;
  187. ofstream fout;
  188. fout.open("userlist.txt");
  189. fout << userno + 1 << endl;
  190. for (j = 0; j <= userno; j++)
  191. {
  192. fout << userlist[j].name << endl;
  193. fout << userlist[j].passwd << endl;
  194. fout << userlist[j].cash << endl;
  195. fout << userlist[j].login_count << endl;
  196. fout << userlist[j].sim_datei << endl;
  197. fout << userlist[j].hold[0] << " " << userlist[j].hold[1] << " " << userlist[j].hold[2] << " " << userlist[j].hold[3] << " " << userlist[j].hold[4] << endl;
  198. }
  199. fout.close();
  200. return userlist[userno];
  201. }
  202. }
  203. } while (true);
  204. }
  205.  
  206. void mainUI(int select, USER one, STOCK s[])
  207. {
  208. char left[7];
  209. char right[7];
  210. int i;
  211. for (i = 0; i < 7; i++)
  212. {
  213. left[i] = ' ';
  214. right[i] = ' ';
  215. }
  216. left[select] = '[';
  217. right[select] = ']';
  218. system("cls");
  219. cout << endl << endl << endl;
  220. cout << " ╔ ═ ╗ ╔ ╗╔ ╗ ╔ ═ ═ ═ ╗" << endl;
  221. cout << " ║ █║ ╔ ◢◣◢◣╗ ║ ███║" << endl;
  222. cout << " ║ █║ ║ █◥◤█║ ║ █ ═ ╣" << endl;
  223. cout << " ║ █║ ║ █╔ ╗ █║ ║ ███║" << endl;
  224. cout << " ║ █║ ║ █║ ║ █║ ║ █╔ ═ ╝" << endl;
  225. cout << " ╚ ═ ╝ ╚ ═ ╝ ╚ ═ ╝ ╚ ═ ╝" << endl << endl << endl << endl;
  226. cout << " " << one.name << " 您好,今日日期為 " << s[0].date[one.sim_datei] << endl;
  227. cout << " 你目前現金有 " << one.cash << " 元,總資產為 " << one.cash << " 元" << endl;
  228. cout << "=============================================================================" << endl;
  229. cout << " " << left[1] << "1" << right[1] << " 投資決策" << endl;
  230. cout << " " << left[2] << "2" << right[2] << " 數獨遊戲" << endl;
  231. cout << " " << left[3] << "3" << right[3] << " 寂寞聊天室" << endl;
  232. cout << " " << left[4] << "4" << right[4] << " 猜數字" << endl;
  233. cout << " " << left[5] << "5" << right[5] << " 富爸爸" << endl;
  234. cout << " " << left[6] << "6" << right[6] << " 變更密碼" << endl;
  235. cout << " " << left[0] << "0" << right[0] << " 離開系統" << endl;
  236. cout << "=============================================================================" << endl << endl;
  237. }
  238.  
  239. void print(int M[9][9])
  240. {
  241. int r, c;
  242. for (r = 0; r < 9; r++)
  243. {
  244. for (c = 0; c < 9; c++)
  245. {
  246. if (M[r][c] > 0)
  247. cout << M[r][c] << " ";
  248. else
  249. cout << " ";
  250. }
  251. cout << endl;
  252. }
  253. }
  254.  
  255. void updateZ(int Z[9][9][10], int r, int c, int num)
  256. {
  257. int x, y;
  258. for (x = 0; x < 9; x++)
  259. Z[r][x][num] = 0;
  260. for (y = 0; y < 9; y++)
  261. Z[y][c][num] = 0;
  262. for (y = r / 3 * 3; y <= r / 3 * 3 + 2; y++)
  263. {
  264. for (x = c / 3 * 3; x <= c / 3 * 3 + 2; x++)
  265. {
  266. Z[y][x][num] = 0;
  267. }
  268. }
  269. Z[r][c][num] = 1;
  270. }
  271.  
  272. int findZ(int Z[9][9][10], int r, int c)
  273. {
  274. int i, count, num;
  275. count = 0;
  276. for (i = 1; i <= 9; i++)
  277. {
  278. if (Z[r][c][i] == 1)
  279. {
  280. count++;
  281. num = i;
  282. }
  283. }
  284. if (count == 1)
  285. return num;
  286. else
  287. return 0;
  288. }
  289.  
  290. void solve(int Q[9][9], int A[9][9])
  291. {
  292. int Z[9][9][10];
  293. int r, c, i;
  294. for (r = 0; r < 9; r++)
  295. {
  296. for (c = 0; c < 9; c++)
  297. {
  298. if (Q[r][c] > 0)
  299. {
  300. A[r][c] = Q[r][c];
  301. for (i = 1; i <= 9; i++)
  302. Z[r][c][i] = 0;
  303. Z[r][c][Q[r][c]] = 1;
  304. }
  305. else
  306. {
  307. A[r][c] = 0;
  308. for (i = 1; i <= 9; i++)
  309. Z[r][c][i] = 1;
  310. }
  311. }
  312. }
  313. for (r = 0; r < 9; r++)
  314. {
  315. for (c = 0; c < 9; c++)
  316. {
  317. if (Q[r][c] > 0)
  318. {
  319. updateZ(Z, r, c, Q[r][c]);
  320. }
  321. }
  322. }
  323. int flag = 1, num;
  324. while (flag == 1)
  325. {
  326. flag = 0;
  327. for (r = 0; r < 9; r++)
  328. {
  329. for (c = 0; c < 9; c++)
  330. {
  331. if (A[r][c] == 0)
  332. {
  333. num = findZ(Z, r, c);
  334. if (num > 0)
  335. {
  336. flag = 1;
  337. A[r][c] = num;
  338. updateZ(Z, r, c, num);
  339. }
  340. }
  341. }
  342. }
  343. }
  344. }
  345.  
  346. void printUI(int M[9][9], int rs, int cs)
  347. {
  348. int r, c;
  349. for (r = 0; r < 9; r++)
  350. {
  351. for (c = 0; c < 9; c++)
  352. {
  353. if (r == rs && c == cs && M[r][c] > 0)
  354. cout << "[" << M[r][c] << "]";
  355. else if (M[r][c] > 0)
  356. cout << " " << M[r][c] << " ";
  357. else if (r == rs && c == cs && M[r][c] == 0)
  358. cout << "[" << " " << "]";
  359. else
  360. cout << " " << " " << " ";
  361. }
  362. cout << endl;
  363. }
  364. }
  365.  
  366. bool compare(int M[9][9], int M1[9][9])
  367. {
  368. int r, c;
  369. for (r = 0; r < 9; r++)
  370. {
  371. for (c = 0; c < 9; c++)
  372. {
  373. if (M[r][c] != M1[r][c])
  374. return false;
  375. }
  376.  
  377. }
  378. return true;
  379. }
  380. int Sudoku_main()
  381. {
  382. int Q[9][9], a, b;
  383. srand(time(NULL));
  384. ifstream fin;
  385. char filename[] = "Q1.txt";
  386. filename[1] = '1' + rand() % 3;
  387. fin.open(filename);
  388. for (a = 0; a < 9; a++)
  389. {
  390. for (b = 0; b < 9; b++)
  391. fin >> Q[a][b];
  392. }
  393. fin.close();
  394. int A[9][9], A1[9][9];
  395. int r = 0, c = 0;
  396. char x, y;
  397. int i, j;
  398. for (i = 0; i < 9; i++)
  399. {
  400. for (j = 0; j < 9; j++)
  401. {
  402. A[i][j] = Q[i][j];
  403. }
  404. }
  405.  
  406. do {
  407. system("cls");
  408. printUI(A, r, c);
  409. x = _getch();
  410. if (x >= '0'&&x <= '9')
  411. {
  412. if (Q[r][c] == 0)
  413. A[r][c] = x - '0';
  414. }
  415. if (x == -32)
  416. {
  417. y = _getch();
  418. switch (y)
  419. {
  420. case 72:
  421. r = (r + 8) % 9;
  422. break;
  423. case 75:
  424. c = (c + 8) % 9;
  425. break;
  426. case 77:
  427. c = (c + 10) % 9;
  428.  
  429. break;
  430. case 80:
  431. r = (r + 10) % 9;
  432. break;
  433. }
  434. }
  435. } while (x != 13);
  436. solve(Q, A1);
  437. if (compare(A, A1))
  438. {
  439. cout << "Correct" << endl;
  440. _getch();
  441. return 1;
  442. }
  443. else
  444. {
  445. cout << "Try again" << endl;
  446. _getch();
  447. return 0;
  448. }
  449. //return 1 win
  450. //return 0 lose
  451. }
  452.  
  453. void Chat_main(USER one)
  454. {
  455. ifstream fin;
  456. ofstream fout;
  457. char str[1000];
  458. char name[21];
  459. strcpy_s(name, one.name);
  460. do {
  461. system("cls");
  462. fin.open("chat.txt");
  463. while (!fin.eof())
  464. {
  465. fin.getline(str, 1000);
  466. cout << str << endl;
  467. }
  468. fin.close();
  469. cout << "===================================" << endl;
  470. cin.getline(str, 1000);
  471. if (strcmp(str, "EXIT") != 0 && strlen(str) != 0)
  472. {
  473. fout.open("chat.txt", std::ofstream::app);
  474. fout << name << ":" << str << endl;
  475. fout.close();
  476. }
  477. } while (strcmp(str, "EXIT") != 0);
  478.  
  479. }
  480.  
  481. void split(int n, int A[])
  482. {
  483. A[0] = n / 1000;
  484. n %= 1000;
  485. A[1] = n / 100;
  486. n %= 100;
  487. A[2] = n / 10;
  488. A[3] = n % 10;
  489. }
  490.  
  491. int legal(int A[])
  492. {
  493. int out = 1;
  494. int i, j;
  495. if (A[0] >= 10)
  496. return 0;
  497. for (i = 0; i < 3; i++)
  498. {
  499. for (j = i + 1; j < 4; j++)
  500. {
  501. if (A[i] == A[j])
  502. out = 0;
  503. }
  504. }
  505. return out;
  506. }
  507.  
  508. void generate(int A[])
  509. {
  510. //method 3
  511. do {
  512. split(rand() % 10000, A);
  513. } while (legal(A) == 0);
  514. }
  515.  
  516. void input(int G[], int tag)
  517. {
  518. int n;
  519. do {
  520. if (tag == 0)
  521. cout << "Please input your answer:";
  522. else
  523. cout << "Please Guess a number:";
  524.  
  525. cin >> n;
  526. split(n, G);
  527. } while (legal(G) == 0);
  528. }
  529.  
  530. void compare(int G[], int A[], int AB[])
  531. {
  532. int i, j;
  533. AB[0] = 0;
  534. for (i = 0; i < 4; i++)
  535. {
  536. if (G[i] == A[i])
  537. AB[0]++;
  538. }
  539. AB[1] = 0;
  540. for (i = 0; i < 4; i++)
  541. {
  542. for (j = 0; j < 4; j++)
  543. {
  544. if (G[i] == A[j])
  545. AB[1]++;
  546. }
  547. }
  548. AB[1] -= AB[0];//?
  549. }
  550.  
  551. int XAXB_main()
  552. {
  553. int cA[4], hA[4], cG[4], hG[4], cAB[2], hAB[2], tA[4], tAB[2];
  554. int AP[10000], i;
  555. int count = 0;
  556. srand(time(NULL));
  557. generate(cA);
  558. input(hA, 0); // human input hA
  559. for (i = 0; i < 10000; i++)
  560. {
  561. split(i, tA);
  562. if (legal(tA) == 1)
  563. AP[i] = 1;
  564. else
  565. AP[i] = 0;
  566. }
  567. do
  568. {
  569. input(hG, 1);
  570. compare(hG, cA, hAB); //AB[0]->A AB[1]->B
  571. count++;
  572. cout << "(H)" << count << ":" << hAB[0] << "A" << hAB[1] << "B" << endl;
  573. // computer guess -> cG
  574. for (i = 0; i < 10000; i++)
  575. {
  576. if (AP[i] == 1)
  577. {
  578. split(i, cG);
  579. cout << "computer guess:" << cG[0] << cG[1] << cG[2] << cG[3] << endl;
  580. break;
  581. }
  582. }
  583. compare(cG, hA, cAB);
  584. cout << "(C)" << count << ":" << cAB[0] << "A" << cAB[1] << "B" << endl;
  585. //update AP
  586. for (i = 0; i < 10000; i++)
  587. {
  588. if (AP[i] == 1)
  589. {
  590. split(i, tA);
  591. compare(cG, tA, tAB);
  592. if (tAB[0] != cAB[0] || tAB[1] != cAB[1])
  593. AP[i] = 0;
  594. }
  595. }
  596. } while (hAB[0] != 4 && cAB[0] != 4);
  597. _getch(); //
  598. if (hAB[0] == 4 && cAB[0] == 4)
  599. {
  600. cout << "平手" << endl;
  601. _getch();
  602. return 2;
  603. }
  604. else if (hAB[0] == 4)
  605. {
  606. cout << "電腦輸了" << endl;
  607. _getch();
  608. return 1;
  609. }
  610. else
  611. {
  612. cout << "電腦贏了" << endl;
  613. _getch();
  614. return 0;
  615. }
  616. //return 1 win
  617. //return 0 lose
  618. return 0;
  619. }
  620.  
  621. USER Change_password(USER one)
  622. {
  623. char passwd1[11];
  624. char passwd2[11];
  625. char passwd3[11];
  626. system("cls");
  627. cout << "password:";
  628. cin >> passwd1;
  629. while (strcmp(one.passwd, passwd1) == 0)
  630. {
  631. cout << "new password:";
  632. cin >> passwd2;
  633. cout << "confirm your password:";
  634. cin >> passwd3;
  635. if (strcmp(passwd2, passwd3) == 0)
  636. {
  637. strcpy_s(one.passwd, passwd3);
  638. cout << "success" << endl;
  639. break;
  640. }
  641. else
  642. break;
  643. }
  644. return one;
  645. }
  646.  
  647. void SaveUser(USER one)
  648. {
  649. USER userlist[1000];
  650. int userno, i, j;
  651. ifstream fin;
  652. //讀取userlist.txt放入userlist[]中
  653. fin.open("userlist.txt");
  654. fin >> userno;
  655. for (i = 0; i < userno; i++)
  656. {
  657. fin >> userlist[i].name;
  658. fin >> userlist[i].passwd;
  659. fin >> userlist[i].cash;
  660. fin >> userlist[i].login_count;
  661. fin >> userlist[i].sim_datei;
  662. for (j = 0; j < 5; j++)
  663. fin >> userlist[i].hold[j];
  664. if (strcmp(userlist[i].name, one.name) == 0) //讀到目前login的使用者,覆蓋他的資料
  665. {
  666. strcpy_s(userlist[i].passwd, one.passwd);
  667. userlist[i].cash = one.cash;
  668. userlist[i].login_count = one.login_count;
  669. for (j = 0; j < 5; j++)
  670. userlist[i].hold[j] = one.hold[j];
  671. }
  672. }
  673. fin.close();
  674. //更新完後寫回userlist.txt
  675. ofstream fout;
  676. fout.open("userlist.txt");
  677. fout << userno << endl;
  678. for (i = 0; i < userno; i++)
  679. {
  680. fout << userlist[i].name << endl;
  681. fout << userlist[i].passwd << endl;
  682. fout << userlist[i].cash << endl;
  683. fout << userlist[i].login_count << endl;
  684. fout << userlist[i].sim_datei << endl;
  685. fout << userlist[i].hold[0] << " " << userlist[i].hold[1] << " " << userlist[i].hold[2] << " " << userlist[i].hold[3] << " " << userlist[i].hold[4] << endl;
  686. }
  687. fout.close();
  688. }
  689.  
  690. USER investment(USER one, STOCK s[])
  691. {
  692. int i, j;
  693. system("cls");
  694. cout << "Your Cash:" << one.cash << endl;
  695. for (i = 0; i < 5; i++)
  696. {
  697. cout << s[i].name << " ";
  698. for (j = -2; j <= 0; j++)
  699. {
  700. cout << s[i].date[one.sim_datei + j] << " ";
  701. cout << s[i].close[one.sim_datei + j] << " ";
  702. }
  703. cout << "Hold: " << one.hold[i] << endl;
  704. }
  705. char company[10];
  706. do {
  707. cout << "Please tell me which company do you want to invest:" << endl;
  708. cin >> company;
  709. if (strcmp(company, "EXIT") == 0)
  710. break;
  711. else
  712. {
  713. bool ok = true;//是否輸入正確股票名稱
  714. for (i = 0; i < 5; i++)
  715. {
  716. if (strcmp(s[i].name, company) == 0)
  717. {
  718. ok = false;
  719. char x, y;
  720. do {
  721. system("cls");
  722. cout << "Your Cash:" << one.cash << endl;
  723. cout << "Hold: " << one.hold[i] << endl;
  724. cout << "Please press 右鍵 or 左鍵 to change the hold or enter to exit" << endl;
  725. x = _getwch();
  726. if (x == -32)
  727. {
  728. y = _getwch();
  729. switch (y)
  730. {
  731. case 77:
  732.  
  733. if (one.cash >= s[i].close[one.sim_datei])
  734. {
  735. one.hold[i]++;
  736. one.cash -= s[i].close[one.sim_datei];
  737. }
  738. break;
  739. case 75:
  740. if (one.hold[i] > 0)
  741. {
  742. one.hold[i]--;
  743. one.cash += s[i].close[one.sim_datei];
  744. }
  745. break;
  746. }
  747. }
  748. } while (x != 13);
  749. }
  750. }
  751. if (ok)
  752. cout << "!!!!!!!!!! Wrong !!!!!!!!!!" << endl;
  753.  
  754. }
  755. } while (true);
  756. //_getwch();
  757. return one;
  758. }
  759.  
  760. int main()
  761. {
  762. USER one;
  763. STOCK s[5];
  764. s[0] = read_stock("AAPL");
  765. s[1] = read_stock("AMZN");
  766. s[2] = read_stock("FB");
  767. s[3] = read_stock("GOOGL");
  768. s[4] = read_stock("MSFT");
  769. one = login();
  770. int select = 1;
  771. char c1, c2;
  772. do
  773. {
  774. mainUI(select, one, s);
  775. c1 = _getch();
  776. if (c1 == -32)
  777. {
  778. c2 = _getch();
  779. if (c2 == 72)
  780. select = (select + 6) % 7;
  781. if (c2 == 80)
  782. select = (select + 1) % 7;
  783. if (c2 == 77)
  784. c1 = 13;
  785. }
  786. if (c1 >= '0'&&c1 <= '6')
  787. select = c1 - '0';
  788. if (c1 == 13)
  789. {
  790. if (select == 1) //投資決策
  791. {
  792. one = investment(one, s);
  793. }
  794. else if (select == 2) //數獨
  795. {
  796. int win = Sudoku_main();
  797. if (win == 1)
  798. one.cash += 5000;
  799. else
  800. one.cash -= 5000;
  801. }
  802. else if (select == 3) //聊天室
  803. {
  804. Chat_main(one);
  805. }
  806. else if (select == 4) //猜數字
  807. {
  808. int win = XAXB_main();
  809. if (win == 1)
  810. one.cash += 5000;
  811. else if (win == 0)
  812. one.cash += 1000;
  813. else
  814. one.cash -= 100;
  815. }
  816. else if (select == 5) //富爸爸
  817. {
  818. one.cash += 1000;
  819. }
  820. else if (select == 6) //變更密碼
  821. {
  822. one = Change_password(one);
  823. }
  824. else // select == 0
  825. {
  826. break;
  827. }
  828. }
  829. } while (true);
  830. SaveUser(one); //把user狀態存回userlist.txt
  831. delete_stock(s[0]);
  832. delete_stock(s[1]);
  833. delete_stock(s[2]);
  834. delete_stock(s[3]);
  835. delete_stock(s[4]);
  836. return 0;
  837. }
  838.  
  839. // 執行程式: Ctrl + F5 或 [偵錯] > [啟動但不偵錯] 功能表
  840. // 偵錯程式: F5 或 [偵錯] > [啟動偵錯] 功能表
  841.  
  842. // 開始使用的秘訣:
  843. // 1. 使用 [方案總管] 視窗,新增/管理檔案
  844. // 2. 使用 [Team Explorer] 視窗,連線到原始檔控制
  845. // 3. 使用 [輸出] 視窗,參閱組建輸出與其他訊息
  846. // 4. 使用 [錯誤清單] 視窗,檢視錯誤
  847. // 5. 前往 [專案] > [新增項目],建立新的程式碼檔案,或是前往 [專案] > [新增現有項目],將現有程式碼檔案新增至專案
  848. // 6. 之後要再次開啟此專案時,請前往 [檔案] > [開啟] > [專案],然後選取 .sln 檔案
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement