Advertisement
heranchris0430

Sagit's 計分程式

Mar 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. // ConsoleApplication4.cpp : 定義主控台應用程式的進入點。
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <stdlib.h>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     int m = 0, n = 0, i = 0, k = 0, j = 0;
  13.     while (1) {
  14.  
  15.         cout << "INPUT";
  16.         cin >> m;
  17.  
  18.         if (m <= 10) {
  19.             n = m * 6;
  20.         }
  21.  
  22.         else if (m > 10 && m < 21) {
  23.             i = m - 10;
  24.             n = 10 * 6;
  25.             j = i * 2;
  26.             n += j;
  27.         }
  28.  
  29.         else if (m > 20 && m < 40) {
  30.             i = 0;
  31.             k = 0;
  32.             j = 0;
  33.             n = 10 * 6;
  34.             i = 20 - 10;
  35.             j = i * 2;
  36.             n += j;
  37.             j = 0;
  38.             k = m - 20;
  39.             j = k * 1;
  40.             n += j;
  41.         }
  42.  
  43.         else if (m >= 40) {
  44.             n = 100;
  45.         }
  46.  
  47.         cout << endl << n;
  48.  
  49.         system("PAUSE");
  50.         system("CLS");
  51.     }
  52.    
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement