代码

· · 个人记录

include <bits/stdc++.h>

include<windows.h>

include<stdio.h>

include<conio.h>

include<time.h>

using namespace std ; int grd [7] , mnynd [5] = { 10 , 20 , 30 , 40 , 50 } , mny ; bool lc [2] ; void SetPos ( int x , int y ) { COORD pos ; pos . X = y * 2 , pos . Y = x ; SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ) , pos ) ; return ; } void Talent ( ) { while ( 1 ) { SetPos ( 1 , 0 ) ; cout << "Talent Money :" << mny<<" " << endl ; SetPos ( 3 , 3 ) ; cout << "Basic Health + " << grd [1] << " -" << endl ; SetPos ( 5 , 3 ) ; cout << "Healing + " << grd [2] << " -" << endl ; SetPos ( 7 , 3 ) ; cout << "Evation + " << grd [3] << " -" << endl ; SetPos ( 9 , 3 ) ; cout << "More Money + " << grd [4] << " -" << endl ; SetPos ( 11 , 3 ) ; cout << "Unkillable + " << grd [5] << " -" << endl ; SetPos ( 13 , 3 ) ; cout << "Over Healing + " << grd [6] << " -" << endl ; int num = getch ( ) - '0' ; if ( 1 <= num && num <= 6 ) { char c = getch ( ) ; if ( c == '+' && mny >= mnynd [grd [num]] && grd [num] < 5 ) { grd [num] ++ ; mny -= mnynd [grd [num] - 1] ; } else if ( c == '-' && grd [num] > 0 ) { grd [num] -- ; mny += mnynd [grd [num]] ; } } } return ; } int main( ) { cin >> mny ; system ( "mode con cols=30 lines=15" ) ; Talent ( ) ; return 0 ; }