-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC83.cpp
59 lines (58 loc) · 986 Bytes
/
C83.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main ()
{
int *n,*nusu,ap=0,ac=0;
n=new int [6];
nusu=new int [4];
srand((unsigned)time(NULL));
for (int i=0;i<6;i++)
{
n[i]=rand()%25+1;
for (int j=0;j<i;j++)
{
if (n[j]==n[i])
{
while (n[j]==n[i])
{
n[i]=rand()%25+1;
}
}
}
}
cout<<"Apuesta: ";
cin>>ap;
cout<<"Numeros: ";
cin>>nusu[0]>>nusu[1]>>nusu[2]>>nusu[3];
for (int i=0;i<4;i++)
{
for (int j=0;j<6;j++)
{
ac+=(nusu[i]==n[j])?1:0;
}
}
if (ac<2)
{
cout<<"\nPerdiste"<<endl;
ap*=0;
}
if (ac==2)
{
cout<<"\nMantienes tu apuesta, mejor suerte para la proxima"<<endl;
}
if (ac==3)
{
cout<<"\nFeliciades! Tu apuesta se multiplica por 10!"<<endl;
ap*=10;
}
if (ac>3)
{
cout<<"\nFeliciades! Tu apuesta se multiplica por 100!!"<<endl;
ap*=100;
}
cout<<"Dinero final: "<<ap<<endl;
delete []n;
delete []nusu;
}