Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by Mikha ( 6 years ago )
int input, angkar, ke, tebak,score5,score6,score7,lie;
int hs1=0,hs2=0,hs3=0;
if (input == 5){
int faktor = 0;
ke=1;
do{
for(int i=1;i <= angkar;i++){
if(angkar%i==0){
faktor++;
}
}
if(faktor == 2){
cout<<"Random Number: "<<angkar<<endl;
do{
lie = rand() % 2 ;
cout<<"Guess "<<ke<<": ";
cin>>tebak;
if(lie == 0){
if(tebak>angkar)cout<<"Lebih Kecil"<<endl;
else cout<<"Lebih Besar"<<endl;
}
else{
if(tebak>angkar)cout<<"Lebih Besar (bohong)"<<endl;
else cout<<"Lebih Kecil (bohong)"<<endl;
}
ke++;
}while(tebak != angkar);
}
else{
faktor = 0;
angkar = rand()%100 + 1;
}
}while(tebak != angkar);
cout<<"selamat anda berhasil menebak!"<<endl;
score5 = 101-ke;
cout<<"Score anda: "<<score5<<endl;
//High Score Calculation
if(score5>=hs1){
hs3=hs2;
hs2=hs1;
hs1=score5;
}
else if(score5>=hs2){
hs3=hs2;
hs2=score5;
}
else if(score5>=hs3){
hs3=score5;
}
}
else if (input == 6){
int a = 0;
int b = 0;
int c = 1;
int checkFibo = 0;
ke=1;
angkar = rand() % 100 + 1;
do{
for(int i = 1;i <= angkar; i++){
a = b + c;
if(angkar == a){
checkFibo++;
}
b = c;
c = a;
}
if(checkFibo == 1){
cout<<"Random Number: "<<angkar<<endl;
do{
lie = rand() % 2 ;
cout<<"Guess "<<ke<<": ";
cin>>tebak;
if(lie == 0){
if(tebak>angkar)cout<<"Lebih Kecil"<<endl;
else cout<<"Lebih Besar"<<endl;
}
else{
if(tebak>angkar)cout<<"Lebih Besar (bohong)"<<endl;
else cout<<"Lebih Kecil (bohong)"<<endl;
}
ke++;
}while(tebak != angkar);
}
else{
a = 0;
b = 0;
c = 1;
checkFibo = 0;
angkar = rand()%100 + 1;
}
}while(tebak != angkar);
cout<<"selamat anda berhasil menebak!"<<endl;
score6 = 101- ke;
cout<<"Score anda: "<<score6<<endl;
//High Score Calculation
if(score6>=hs1){
hs3=hs2;
hs2=hs1;
hs1=score6;
}
else if(score6>=hs2){
hs3=hs2;
hs2=score6;
}
else if(score6>=hs3){
hs3=score6;
}
}
else if (input == 7) {
int a = 0;
int b = 0;
int c = 1;
int checkFibo = 0;
int faktor = 0;
ke=1;
angkar = rand() % 100 + 1;
do{
for(int i=1;i <= angkar;i++){
if(angkar%i==0){
faktor++;
}
}
for(int i = 1;i <= angkar; i++){
a = b + c;
if(angkar == a){
checkFibo++;
}
b = c;
c = a;
}
if(checkFibo == 1 && faktor == 2){
cout<<"Random Number: "<<angkar<<endl;
do{
lie = rand() % 2 ;
cout<<"Guess "<<ke<<": ";
cin>>tebak;
if(lie == 0){
if(tebak>angkar)cout<<"Lebih Kecil"<<endl;
else cout<<"Lebih Besar"<<endl;
}
else{
if(tebak>angkar)cout<<"Lebih Besar (bohong)"<<endl;
else cout<<"Lebih Kecil (bohong)"<<endl;
}
ke++;
}while(tebak != angkar);
}
else{
a = 0;
b = 0;
c = 1;
checkFibo = 0;
faktor = 0;
angkar = rand()%100 + 1;
}
}while(tebak != angkar);
cout<<"selamat anda berhasil menebak!"<<endl;
score7 = 101 - ke;
cout<<"Score anda: "<<score7<<endl;
//High Score Calculation
if(score7>=hs1){
hs3=hs2;
hs2=hs1;
hs1=score7;
}
else if(score7>=hs2){
hs3=hs2;
hs2=score7;
}
else if(score7>=hs3){
hs3=score7;
}
}
else if(input==8){
cout<<"HIGH SCORE"<<endl;
//High Score 1
if(hs1==0){
cout<<"-"<<endl;
}
else{
cout<<hs1<<endl;
}
//High Score 2
if(hs2==0){
cout<<"-"<<endl;
}
else{
cout<<hs2<<endl;
}
//High Score 3
if(hs3==0){
cout<<"-"<<endl;
}
else{
cout<<hs3<<endl;
}
}
Revise this Paste