问题标题: 老虎机魔改版(你值得拥有)

0
0
郑喜恩
郑喜恩
初级光能
初级光能

#include<iostream>
#include<cstdlib>
#include<ctime>
#include<windows.h>
class SlotMachine{
double credits;
int symbols[3];
public:
SlotMachine():credits(100000000000000){
srand(time(0));}
void spin(){
if(credits<0.0000000000000000001){
std::cout<<"余额不足!"<<std::endl;
return;}
credits-=0.0000000000000000001;
for(int i=0;i<3;i++)
symbols[i]=rand()%7;
display();
checkWin();}
void display(){
system("cls");
std::cout<<"余额:"<<credits<<"    下注:0.0000000000000000001"<<std::endl;
std::cout<<"-------------"<<std::endl;
for(int i=0;i<3;i++){
std::cout<<"|";
switch(symbols[i]){
case 0:std::cout<<"你看你长得那个*样";break;
case 1:std::cout<<"我*你妈那个*的";break;
case 2:std::cout<<"傻*";break;
case 3:std::cout<<"cinema";break;
case 4:std::cout<<"*你丫的";break;
case 5:std::cout<<"妈了个*";break;
case 6:std::cout<<"*你妈*";break;}
std::cout<<"|";}
std::cout<<std::endl;
std::cout<<"-------------"<<std::endl;
std::cout<<"按回车转动,按q退出"<<std::endl;}
void checkWin(){
if(symbols[0]==symbols[1]&&symbols[1]==symbols[2]){
int prize=0;
switch(symbols[0]){
case 0:prize=100;break;
case 1:prize=50;break;
case 2:prize=30;break;
default:prize=20;break;}
credits+=prize;
std::cout<<"赢得"<<prize<<"分!"<<std::endl;}}
void run(){
char input;
display();
while(true){
input=getchar();
if(input=='q')break;
if(input=='\n')spin();}}
int getCredits()const{return credits;}};
int main(){
SlotMachine game;
game.run();
return 0;}
 


0
0
0
0
朱宥宇
朱宥宇
初级光能
初级光能

emm,你这把我写的改的太奇葩了吧

0
0
0
王奕诚
王奕诚
中级守护
中级守护

这个

是不是有点

太......

我要回答