Update
parent
65683bcf7f
commit
b8b7b710d0
BIN
CashWorld.cpp
BIN
CashWorld.cpp
Binary file not shown.
|
@ -0,0 +1,40 @@
|
|||
#include "ui_helper.h"
|
||||
#include <Windows.h>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
void ClearScreen()
|
||||
{
|
||||
system("cls");
|
||||
}
|
||||
|
||||
void ClearInput()
|
||||
{
|
||||
int c;
|
||||
while ((c = getchar()) != '\n' && c != EOF);
|
||||
}
|
||||
|
||||
void WaitPause()
|
||||
{
|
||||
system("pause");
|
||||
}
|
||||
|
||||
void title(const std::string& xtitle)
|
||||
{
|
||||
ClearScreen();
|
||||
printf("==============================\n");
|
||||
printf("%s\n", xtitle.c_str());
|
||||
printf("==============================\n");
|
||||
}
|
||||
|
||||
int GetChoice(int max_id)
|
||||
{
|
||||
int x;
|
||||
while (scanf("%d", &x) != 1 || x<1 || x>max_id)
|
||||
{
|
||||
printf("输入有误. 应为在1~%d范围内的数字. 请重试.\n", max_id);
|
||||
ClearInput();
|
||||
}
|
||||
ClearInput();
|
||||
return x;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
void ClearScreen();
|
||||
void ClearInput();
|
||||
|
||||
void WaitPause();
|
||||
|
||||
void title(const std::string& xtitle);
|
||||
|
||||
int GetChoice(int max_id);
|
Loading…
Reference in New Issue