Advertisement
heranchris0430

商人本性

Apr 7th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     double a = 0, b = 0, c = 0, d[99999] = { 0 }, e[2] = { -7 , 10 }, m;
  10.     int i = 0;
  11.  
  12.     while (1) {
  13.    
  14.         cout << "投資:";
  15.         cin >> i;
  16.  
  17.         for (int k = 0; k < i; k++){
  18.             cin >> a >> b;
  19.             c = b - a;
  20.             d[k] = c / a;
  21.             d[k] *= 100;
  22.            
  23.         }
  24.  
  25.         for (int k = 0; k < i; k++) {
  26.             cout << d[k] << " %";
  27.             if (d[k] <= e[0] || d[k] >= e[1]) {
  28.                 cout << " , Dispose" << endl;
  29.             }
  30.             else {
  31.                 cout << " , keep" << endl;
  32.             }
  33.         }
  34.  
  35.         system("PAUSE");
  36.         system("CLS");
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement