Tugas Struktur Data, Riski Ramdan 121514
#include <iostream>
#include <string.h>
#include <ctime>
#include <cstdlib>
#include <conio.h>
using namespace std;
int i,j,pil,k;
int W,L,D,P;
int goal1,goal2,xRan1,xRan2;
string tim1,tim2;
string tim[16];
namaTim(){
tim[0]="Persib";
tim[1]="Persija";
tim[2]="Persebaya";
tim[3]="Persiba";
tim[4]="Perseru";
tim[5]="Persepura";
tim[6]="Persiwa";
tim[7]="Persikabo";
tim[8]="Persikab";
tim[9]="Arsenal";
tim[10]="ManchesterU";
tim[11]="ManchesterC";
tim[12]="Chelsea";
tim[13]="Tottenham";
tim[14]="AcMilan";
tim[15]="Juventus";
cout<<"=============KLASEMEN LIGA============= \n";
cout<<"| no | Nama Tim | M | S | K | P | \n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"| 01 | Persib | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 02 | Persija | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 03 | Persebaya | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 04 | Persiba | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 05 | Perseru | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 06 | Persepura | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 07 | Persiwa | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 08 | Persikabo | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 09 | Persikab | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 10 | Arsenal | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 11 | ManchesterU | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 12 | ManchasterC | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 13 | Chelsea | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 14 | Tottenham | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 15 | AcMilan | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"| 16 | Juventus | "<<W<<" | "<<D<<" | "<<L<<" | "<<P<<" |\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"| 1.Keluar |\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"Pilihan Anda : ";
cin>>pil;
switch(pil){
case 1: system("cls");
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"|Terima Kasih Telah Menggunakan Aplikasi Kami|"<<endl;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
break;
}
// for(k=0;k<16;k++)
// {
// cout<<"| "<<k+1<<" |"<<tim[k]<<" \n";
// }
}
input_tim(){
cout<<"=============PERTANDINGAN=============\n";
cout<<"| Input Team Yang Akan Bertanding |\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<" HOME : ";
cin>>tim1;
cout<<" AWAY : ";
cin>>tim2;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
}
input_goal(){
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"| Input Goal |\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<" HOME : ";cin>>goal1;
cout<<" AWAY : ";cin>>goal2;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
}
tarung(){
srand(time(0));
xRan1=rand()%5+1;
xRan2=rand()%5+1;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"| Enter Untuk Melihat Hasil Tanding |\n";
getch();
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<" "<<tim1<<" "<<"["<<xRan1<<"]"<<" vs "<<"["<<xRan2<<"]"<<" "<<tim2<<"\n";
input_goal();
}
timtanding(){
input_tim();
cout<<" "<<tim1<<" ";
cout<<" vs ";
cout<<tim2<<" \n";
}
pertandingan(){
timtanding();
tarung();
if (goal1 > goal2)
{
cout<<" Team "<<tim1<<" Dinyatakan Menang"<< endl;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
}
else if(goal1 < goal2)
{
cout<<" Team "<<tim2<<" Dinyatakan Menang"<< endl;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
}
else{
cout<<" Hasil Seri"<<endl;
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
}
cout<<"| 1. Lihat Klasmen |\n";
cout<<"| 2. Keluar |\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"Pilihan Anda (1,2) : ";
cin>>pil;
switch(pil){
case 1: system("cls");
namaTim();
break;
case 2: system("cls");
cout<<"----------------------------------------------"<<endl;
cout<<"|Terima Kasih Telah Menggunakan Aplikasi Kami|"<<endl;
cout<<"----------------------------------------------"<<endl;
break;
}
}
main(){
awal:
cout<<"==========APLIKASI TANDING BOLA==========\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"| 1. Tampil Klasmen |\n";
cout<<"| 2. Pertandingan |\n";
cout<<"| 3. Keluar |\n";
cout<<"|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|\n";
cout<<"Pilihan Anda (1,2,3) : ";
cin>>pil;
switch(pil){
case 1: system("cls");
namaTim();
break;
case 2: system("cls");
pertandingan();
break;
case 3: system("cls");
cout<<"----------------------------------------------"<<endl;
cout<<"|Terima Kasih Telah Menggunakan Aplikasi Kami|"<<endl;
cout<<"----------------------------------------------"<<endl;
break;
}
}
0 comments:
Post a Comment