Loading...
Dacă eşti vizitator şi vrei să te înregistrezi, apasă aici.

Joc C++

» phpBB 3.0.x, MyBB, HTML, CSS, PHP & MySQL .htaccess .etc.
Avatar utilizator
BigMenBalls
Membru
Mesaje: 5
Membru din: 11 Feb 2017, 15:22
Țara de origine: Romania
Nume Real: Marius
Nivel cunoştinţe IT: 5
Status: Neconectat

Joc C++

Mesajde BigMenBalls » 11 Feb 2017, 15:58

Aztazi am facut ultimele setari la joc, nu este cine stie ce, dar ma bucur ca functioneaza.Pentru clasa a 9-a, eu zic ca e destul de reusit

CODUL:

#include <iostream>
#include<stdlib.h>
#include <time.h>
#include<fstream>
#include<windows.h>

using namespace std;

int main()
{


int a,b,iSecret,c,a1,ok,ct,q,w,e,r,t,y,ctt=1,q1,w1,e1,r1,t1,y1,money;
srand (time(NULL));
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
cout<<"input the money please ";
cin>>a;
cout<<"You have "<<a<<" dollars. All the games cost 10 dollars."<<endl<<endl;

while(a<10)
{
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
cout<<"You need "<<10-a<<" dollars to continue"<<endl;
cin>>a1;
a=a+a1;

}
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
while(ctt==1){
while(a<10)
{
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
cout<<"You need "<<10-a<<" dollars to continue"<<endl;
cin>>a1;
a=a+a1;}

cout<<"======= Select a game by pressing one number ====== You have: "<<a<<" dollars"<<endl;
cout<<"1.Higher/lower"<<endl;
cout<<"2.Stars"<<endl;
cout<<"3.The number"<<endl;
cout<<"4.6/49"<<endl;

cin>>b;
cout<<endl;
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
switch(b)
{
case 1:cout<<"You selected Higher/Lower. One number will appear and you have to say if the next number will be higher or lower"<<endl;break;
case 2:cout<<"You selected Stars"<<endl;break;
case 3:cout<<"What is the number ?"<<endl;break;
case 4:cout<<"6/49"<<endl;break;
}

if(b==1)
{
ok=1;
while(ok==1)
{
while(a<10)
{
cout<<"You need "<<10-a<<" dollars to continue"<<endl;
cin>>a1;
a=a+a1;

}
iSecret = rand() % 1000 + 1;
q=iSecret;
cout<<"Press 1 for higher and 0 for lower "<<endl;
cout<<" "<<iSecret<<" ";
cout<<endl;
cin>>c;
cout<<endl;
iSecret = rand() % 1000 + 1;
if(c==1){
if(c==1 && iSecret>q){
cout<<"You won "<<10<<endl;
a=a+20;}
else{
cout<<"Sorry, you lost.";
}}
if(c==0){
if(c==0 && iSecret<q){
cout<<"You won "<<10<<endl;
a=a+20;}
else{
cout<<"Sorry, you lost.";
a=a-10;}}


cout<<"Do you want to continue ? Press 1 for YES and 0 for NO"<<endl;
cin>>ok;
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
}

}
if(b==2)
{
ok=1;
while(ok==1)
{
while(a<10)
{
cout<<"You need "<<10-a<<" dollars to continue"<<endl;
cin>>a1;
a=a+a1;

}
cout<<"How many stars will appear ?"<<endl;
cin>>c;
iSecret = rand() % 5 + 1;
ct=iSecret;
while(iSecret!=0){
cout<<"* ";
Sleep(1000);
iSecret=iSecret-1;}
if(ct==c){
cout<<"You won 50 dollars"<<endl;
a=a+60;}
else
cout<<"Sorry, you lost"<<endl;
a=a-10;
cout<<"Do you want to continue ? Press 1 for YES and 0 for NO"<<endl;
cin>>ok;
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;
}
}
if(b==3)
{
ok=1;
while(ok==1)
{
while(a<10)
{

cout<<"You need "<<10-a<<" dollars to continue"<<endl;
cin>>a1;
a=a+a1;
}
q=iSecret = rand() % 100 + 1;
w=iSecret = rand() % 100 + 1;
e=iSecret = rand() % 100 + 1;
r=iSecret = rand() % 100 + 1;
t=iSecret = rand() % 100 + 1;
cout<<q<<" "<<w<<" "<<e<<" "<<r<<" "<<t<<endl;
y=rand()%4;
switch(y)
{
case 0:y=q;break;
case 1:y=w;break;
case 2:y=e;break;
case 3:y=r;break;
case 4:y=t;break;
}
cin>>c;
if(c==y){
cout<<"You won 50"<<endl;
a=a+60;}
else
cout<<"You lost"<<endl;
a=a-10;
cout<<"Do you want to continue ? Press 1 for YES and 0 for NO"<<endl;
cin>>ok;
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;

}
}
if(b==4)
{
ok=1;
while(ok==1)
{
while(a<10)
{

cout<<"You need "<<10-a<<" dollars to continue"<<endl;
cin>>a1;
a=a+a1;
}
q = rand() % 49 + 1;
w = rand() % 49 + 1;
e = rand() % 49 + 1;
r = rand() % 49 + 1;
t = rand() % 49 + 1;
y = rand() % 49 + 1;

if(q==w)
w = rand() % 49 + 1;
if(q==e)
e = rand() % 49 + 1;
if(q==r)
r = rand() % 49 + 1;
if(q==t)
t = rand() % 49 + 1;
if(q==y)
y = rand() % 49 + 1;
if(w==e)
e = rand() % 49 + 1;
if(w==r)
r = rand() % 49 + 1;
if(w==t)
t = rand() % 49 + 1;
if(w==y)
y = rand() % 49 + 1;
if(e==r)
r = rand() % 49 + 1;
if(e==t)
t = rand() % 49 + 1;
if(e==y)
y = rand() % 49 + 1;
if(r==t)
t = rand() % 49 + 1;
if(r==y)
y = rand() % 49 + 1;
if(t==y)
y = rand() % 49 + 1;
cin>>q1>>w1>>e1>>r1>>t1>>y1;

if(q1==q && w1==w && e1==e && r1==r && t1==t && y1==y){
cout<<"YOU WON 1.000.000 DOLLARS !!!"<<endl;
a=a+1000010;}
else
cout<<"Sorry, the numbers selected were "<<q<<" "<<w<<" "<<e<<" "<<r<<" "<<t<<" "<<y<<endl;
a=a-10;

cout<<"Do you want to continue ? Press 1 for YES and 0 for NO"<<endl;
cin>>ok;
system("cls");
cout<<" Welcome to pacanele v2.1 by Marius "<<endl<<endl;


}
}

}

return 0;
}


SAU APLICATIA : main


*** Daca gasiti probleme la rulare sau greseli de scriere/citire va rog sa ma anuntati

Înapoi la “Programare”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 2 vizitatori

cron