From fd734cd87fd5c05ac00f03cca1776587c7ce69c9 Mon Sep 17 00:00:00 2001 From: Alexius Adhitya K Date: Tue, 27 Nov 2018 15:26:06 +0700 Subject: [PATCH] Update Nov'18 --- 3-11.cpp | 32 +++++ 3-13.cpp | 23 +++ 3-14.cpp | 29 ++++ 3-15.cpp | 32 +++++ 3-16.cpp | 24 ++++ 3-41.cpp | 33 +++++ 4-41.cpp | 19 +++ 4-42.cpp | 21 +++ 4-43.cpp | 82 +++++++++++ 4-44.cpp | 48 +++++++ 5-41.cpp | 22 +++ 5-42.cpp | 29 ++++ AllSort.cpp | 249 +++++++++++++++++++++++++++++++++ Array2.cpp | 55 ++++---- BinSearch.cpp | 34 +++++ BubbleSort.cpp | 28 ++++ Circle.cpp | 13 ++ DataMahasiswaRev1.cpp | 80 +++++++++++ DataMahasiswaRev2.cpp | 84 +++++++++++ Determinant.cpp | 32 +++++ Fifteen.cpp | 21 +++ FuncCircleArea.cpp | 21 +++ FuncInc.cpp | 18 +++ FuncMax.cpp | 20 +++ HelloWorld.cpp | 12 ++ HitungLuup.cpp | 25 ++++ InsertSort.cpp | 26 ++++ Kuis1.cpp | 93 ++++++++++++ Kuis2.cpp | 108 ++++++++++++++ MergeSort.cpp | 52 +++++++ MultiCalc.cpp | 49 +++++++ Multiply2Arr.cpp | 32 +++++ NISN-NILAI.cpp | 318 ++++++++++++++++++++++++++++++++++++++++++ OddEven.cpp | 19 +++ POSRev1.cpp | 67 +++++++++ Pecahan.cpp | 17 +++ Point1.cpp | 24 ++++ Point1.exe | Bin 0 -> 44703 bytes Point2.cpp | 15 ++ Point4.cpp | 18 +++ Pointer.cpp | 30 ++++ Pythagoras.cpp | 18 +++ QuikSort.cpp | 52 +++++++ Quiz.cpp | 64 +++++++++ Real.cpp | 23 +++ S1.cpp | 18 +++ ScoreCalc.cpp | 41 ++++++ SelectSort.cpp | 26 ++++ SeqSearch.cpp | 24 ++++ SoalBinus.cpp | 54 +++++++ TermoConv.cpp | 10 +- Test1.cpp | 18 +++ TheLoop.cpp | 16 +++ Training2.cpp | 22 +++ Training4.cpp | 12 ++ TriSqrCirc.cpp | 33 +++++ TriStar.cpp | 33 +++++ TubeCalc.cpp | 19 +++ TwotheBiggest.cpp | 21 +++ WeirdLog.cpp | 22 +++ Who'sBiggest.cpp | 38 +++++ YourID.cpp | 21 +++ 62 files changed, 2506 insertions(+), 33 deletions(-) create mode 100644 3-11.cpp create mode 100644 3-13.cpp create mode 100644 3-14.cpp create mode 100644 3-15.cpp create mode 100644 3-16.cpp create mode 100644 3-41.cpp create mode 100644 4-41.cpp create mode 100644 4-42.cpp create mode 100644 4-43.cpp create mode 100644 4-44.cpp create mode 100644 5-41.cpp create mode 100644 5-42.cpp create mode 100644 AllSort.cpp create mode 100644 BinSearch.cpp create mode 100644 BubbleSort.cpp create mode 100644 Circle.cpp create mode 100644 DataMahasiswaRev1.cpp create mode 100644 DataMahasiswaRev2.cpp create mode 100644 Determinant.cpp create mode 100644 Fifteen.cpp create mode 100644 FuncCircleArea.cpp create mode 100644 FuncInc.cpp create mode 100644 FuncMax.cpp create mode 100644 HelloWorld.cpp create mode 100644 HitungLuup.cpp create mode 100644 InsertSort.cpp create mode 100644 Kuis1.cpp create mode 100644 Kuis2.cpp create mode 100644 MergeSort.cpp create mode 100644 MultiCalc.cpp create mode 100644 Multiply2Arr.cpp create mode 100644 NISN-NILAI.cpp create mode 100644 OddEven.cpp create mode 100644 POSRev1.cpp create mode 100644 Pecahan.cpp create mode 100644 Point1.cpp create mode 100644 Point1.exe create mode 100644 Point2.cpp create mode 100644 Point4.cpp create mode 100644 Pointer.cpp create mode 100644 Pythagoras.cpp create mode 100644 QuikSort.cpp create mode 100644 Quiz.cpp create mode 100644 Real.cpp create mode 100644 S1.cpp create mode 100644 ScoreCalc.cpp create mode 100644 SelectSort.cpp create mode 100644 SeqSearch.cpp create mode 100644 SoalBinus.cpp create mode 100644 Test1.cpp create mode 100644 TheLoop.cpp create mode 100644 Training2.cpp create mode 100644 Training4.cpp create mode 100644 TriSqrCirc.cpp create mode 100644 TriStar.cpp create mode 100644 TubeCalc.cpp create mode 100644 TwotheBiggest.cpp create mode 100644 WeirdLog.cpp create mode 100644 Who'sBiggest.cpp create mode 100644 YourID.cpp diff --git a/3-11.cpp b/3-11.cpp new file mode 100644 index 0000000..a469f6d --- /dev/null +++ b/3-11.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; + +int main() +{ + int x=10,y=33,z=0; + cout << "Inisialisasi" << endl; + cout << "x=" << x << endl; + cout << "y=" << y << endl; + cout << "z=" << z << endl; + + z=x; + cout << "Pertukaran Pertama" << endl; + cout << "x=" << x << endl; + cout << "y=" << y << endl; + cout << "z=" << z << endl; + + x=y; + cout << "Pertukaran Kedua" << endl; + cout << "x=" << x << endl; + cout << "y=" << y << endl; + cout << "z=" << z << endl; + + y=z; + cout << "Pertukaran Ketiga" << endl; + cout << "x=" << x << endl; + cout << "y=" << y << endl; + cout << "z=" << z << endl; + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/3-13.cpp b/3-13.cpp new file mode 100644 index 0000000..b7a1ddb --- /dev/null +++ b/3-13.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; + +int main() +{ + int a; + float jumlah=0; + cout << "Masukan nilai = "; + cin >> a; + + if(a>10) + { + jumlah=jumlah+a; + } + else + { + jumlah=jumlah-a; + } + cout << "Jumlah = " << jumlah << endl; + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/3-14.cpp b/3-14.cpp new file mode 100644 index 0000000..c8e04da --- /dev/null +++ b/3-14.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; + +int main() +{ + int input; + cout << "Masukan hari ke="; + cin >> input; + + if(input==1) + { cout << "Hari Senin\n"; } + else if(input==2) + { cout << "Hari Selasa\n"; } + else if(input==3) + { cout << "Hari Rabu\n"; } + else if(input==4) + { cout << "Hari Kamis\n"; } + else if(input==5) + { cout << "Hari Jumat\n"; } + else if(input==6) + { cout << "Hari Sabtu\n"; } + else if(input==7) + { cout << "Hari Minggu\n"; } + else + { cout << "Salah input\n"; } + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/3-15.cpp b/3-15.cpp new file mode 100644 index 0000000..0e85be7 --- /dev/null +++ b/3-15.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; + +int main() +{ + int input; + cout << "Masukan hari ke-"; + cin >> input; + + switch(input) + { + case 1: cout << "Hari Minggu\n"; + break; + case 2: cout << "Hari Senin\n"; + break; + case 3: cout << "Hari Selasa\n"; + break; + case 4: cout << "Hari Rabu\n"; + break; + case 5: cout << "Hari Kamis\n"; + break; + case 6: cout << "Hari Jumat\n"; + break; + case 7: cout << "Hari Sabtu\n"; + break; + default: cout << "Salah input\n"; + break; + } + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/3-16.cpp b/3-16.cpp new file mode 100644 index 0000000..687a15e --- /dev/null +++ b/3-16.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; + +int main() +{ + int input; + cout << "Masukan hari ke-"; + cin >> input; + + switch(input) + { + case 1: cout << "Hari Minggu\n"; + case 2: cout << "Hari Senin\n"; + case 3: cout << "Hari Selasa\n"; + case 4: cout << "Hari Rabu\n"; + case 5: cout << "Hari Kamis\n"; + case 6: cout << "Hari Jumat\n"; + case 7: cout << "Hari Sabtu\n"; + default: cout << "Salah input\n"; + } + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/3-41.cpp b/3-41.cpp new file mode 100644 index 0000000..0d15fe7 --- /dev/null +++ b/3-41.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; + +int main() +{ + int x; + cout << "Masukan Nilai Anda="; + cin >> x; + + if(x>=85) + { + cout << "A" << endl; + } + else if(x>=70) + { + cout << "B" << endl; + } + else if(x>=40) + { + cout << "C" << endl; + } + else if(x>=20) + { + cout << "D" << endl; + } + else + { + cout << "E" << endl; + } + + system("pause"); + return 0; +} diff --git a/4-41.cpp b/4-41.cpp new file mode 100644 index 0000000..5468aa1 --- /dev/null +++ b/4-41.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; + +int main() +{ + int x,y,z=0; + cout << "Masukan jumlah angka yang ingin ditampilkan= "; + cin >> x; + + for(y=1;y<=x;y++) + { + z=z+1; + cout << z << " "; + } + + cout << " \n"; + system("pause"); + return 0; +} \ No newline at end of file diff --git a/4-42.cpp b/4-42.cpp new file mode 100644 index 0000000..89f86db --- /dev/null +++ b/4-42.cpp @@ -0,0 +1,21 @@ +#include +#include +using namespace std; + +int main() +{ + int x,z=1; + char y; + cout << "Masukan jumlah huruf yang ingin ditampilkan= "; + cin >> x; + + for(y='A';z<=x;y++) + { + cout << y << " "; + z=z+1; + } + + cout << " \n"; + system("pause"); + return 0; +} \ No newline at end of file diff --git a/4-43.cpp b/4-43.cpp new file mode 100644 index 0000000..1873b4e --- /dev/null +++ b/4-43.cpp @@ -0,0 +1,82 @@ +#include +using namespace std; + +int main() +{ + int limit,star1,star2,star3,x,y,i; + cin >> limit; + cout << "STAR 1" << endl; + for(star1=1;star1<=limit;star1++) + { + x=limit-star1; + y=0; + while(x>0) + { + cout << " "; + x--; + } + while(y0) + { + cout << " "; + x--; + } + while(y +using namespace std; + +int main() +{ + int x,y,z=0,a=0,c=1,d=0; + cout << "Masukan batas tabel perkalian yang ingin ditampilkan= "; + cin >> x; + + cout << "*" << " "; + for(y=1;y<=x;y++) + { + z=z+1; + cout << z << " "; + } + cout << " \n"; + while(c<=x) + { + d=d+1; + int b=1; + if(d>9) + { + cout << d << " "; + } + else + { + cout << d << " "; + } + for(y=1;y<=x;y++) + { + a=d*b; + if(a>9) + { + cout << a << " "; + } + else + { + cout << a << " "; + } + b=b+1; + } + c=c+1; + cout << " \n"; + } + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/5-41.cpp b/5-41.cpp new file mode 100644 index 0000000..dec7e53 --- /dev/null +++ b/5-41.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +int main() +{ + int input,n,a,b,x=0,y=0,sum=0; + cout << "Masukan jumlah angka yang ingin dihitung= "; + cin >> n; + int plus[n]; + for(x=0;x> plus[x]; + } + for(x=0;x +using namespace std; + +int main() +{ + int x,y=0,a,b,c=0; + int bin[32]; + cout << "Masukan sebuah angka= "; + cin >> x; + while(y<=32) + { + bin[y]=x%2; + x=x/2; + y=y+1; + } + for(y=31;y>=0;y--) + { + cout << bin[y]; + c=c+1; + if(c==8) + { + cout << " "; + c=0; + } + } + cout << " " << endl; + system("pause"); + return 0; +} \ No newline at end of file diff --git a/AllSort.cpp b/AllSort.cpp new file mode 100644 index 0000000..b8de03e --- /dev/null +++ b/AllSort.cpp @@ -0,0 +1,249 @@ +#include +#include +using namespace std; + +int data_main[1000]; +int data_new[1000]; + +void merge_sort(int low, int mid, int high) +{ + int l1,l2,i; + for(l1=low,l2=mid+1,i=low;l1<=mid&&l2<=high;i++) + { + if(data_main[l1]<=data_main[l2]) + data_new[i]=data_main[l1++]; + else + data_new[i]=data_main[l2++]; + } + while(l1<=mid) + data_new[i++]=data_main[l1++]; + while(l2<=high) + data_new[i++]=data_main[l2++]; + for(i=low;i<=high;i++) + data_main[i]=data_new[i]; +} + +void sort(int low, int high) +{ + int mid; + if(low -#include -using namespace std; - -int main() -{ - cout << "Array Test Case" << endl; - char x[10]; - char y[10]; - cout << "Ketik sebuah kata: "; - cin >> x; - - strcpy(y,"QWERT"); - cout << "Tes strcpy : " << y << endl; - - strncat(y,x,5); - cout << "Tes strncat: " << y << endl; - - cout << "Tes strcmp : "; - cout << strcmp(x,y) << endl; - - cout << "Jumlah array 1:"; - cout << strlen(x) << endl; - cout << "Jumlah array 2:"; - cout << strlen(y) << endl; - - return 0; +#include +#include +using namespace std; + +int main() +{ + cout << "Array Test Case" << endl; + char x[100]; + char y[100]; + cout << "Ketik sebuah kata: "; + cin >> x; + + strcpy(y,"QWERT"); + cout << "Tes strcpy : " << y << endl; + + strncat(y,x,5); + cout << "Tes strncat : " << y << endl; + + cout << "Tes strcmp : "; + cout << strcmp(x,y) << endl; + + cout << "Jumlah array 1: "; + cout << strlen(x) << endl; + cout << "Jumlah array 2: "; + cout << strlen(y) << endl; + + system("pause"); + return 0; } \ No newline at end of file diff --git a/BinSearch.cpp b/BinSearch.cpp new file mode 100644 index 0000000..ec89909 --- /dev/null +++ b/BinSearch.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; + +int main() +{ + bool found=false; + int data[]={0,1,2,3,4,5,6,7,8,9,10}; + int i=0,j=sizeof(data)/sizeof(data[0]),k,query=9; + while(!found&&i<=j) + { + k=(i+j)/2; + if(data[k] +using namespace std; + +int main(){ + int inp; + cin >> inp; + int myArr[inp]; + int a=0,b,c,d; + for(b=0;b> myArr[b]; + } + while(amyArr[c]){ + d=myArr[b]; + myArr[b]=myArr[c]; + myArr[c]=d; + } + } + a++; + } + for(b=0;b +using namespace std; + +int main() +{ + int r; + cout << "Masukan jari-jari lingkaran" << endl; + cin >> r; + + int L=r*r*3.14; + cout << L << endl; + return 0; +} \ No newline at end of file diff --git a/DataMahasiswaRev1.cpp b/DataMahasiswaRev1.cpp new file mode 100644 index 0000000..364c598 --- /dev/null +++ b/DataMahasiswaRev1.cpp @@ -0,0 +1,80 @@ +#include +#include +using namespace std; + +struct mahasiswa +{ + string name; + int age; + float gpa; +}; + +mahasiswa data[1000]; + +int main() +{ + int menu,input,inp,a,b,c; + top: + cout << "Menu" << endl; + cout << "1. Add student data" << endl; + cout << "2. Edit student data" << endl; + cout << "3. View student data" << endl; + cout << "4. Exit" << endl; + cout << "========================\n"; + cout << "Menu "; + cin >> menu; + switch(menu) + { + case 1: + cout << "How much data would you like to input? "; + cin >> input; + for(a=0;a> input; + input=input-1; + cout << "Existing data\n"; + cout << "Name= " << data[input].name << endl; + cout << "Age = " << data[input].age << endl; + cout << "IPK = " << data[input].gpa << endl; + cout << "========================\n"; + cout << "New data\n"; + cout << "Name= "; + cin >> data[input].name; + cout << "Age = "; + cin >> data[input].age; + cout << "IPK = "; + cin >> data[input].gpa; + system("pause"); + cout << endl; + goto top; + case 3: + cout << "Which data would you like to see? "; + cin >> input; + c=input-1; + cout << "Data " << input << endl; + cout << "Name= " << data[c].name << endl; + cout << "Age = " << data[c].age << endl; + cout << "IPK = " << data[c].gpa << endl; + cout << "========================\n"; + system("pause"); + cout << endl; + goto top; + default: + break; + } + system("pause"); + return 0; +} \ No newline at end of file diff --git a/DataMahasiswaRev2.cpp b/DataMahasiswaRev2.cpp new file mode 100644 index 0000000..a808e26 --- /dev/null +++ b/DataMahasiswaRev2.cpp @@ -0,0 +1,84 @@ +#include +#include +using namespace std; + +struct mahasiswa +{ + string name; + int age; + float gpa; +}; + +mahasiswa data[1000]; + +int main() +{ + int menu,input,inp,a,b,c; + top: + cout << "Menu" << endl; + cout << "1. Add student data" << endl; + cout << "2. Edit student data" << endl; + cout << "3. View student data" << endl; + cout << "4. Exit" << endl; + cout << "========================\n"; + cout << "Menu "; + cin >> menu; + switch(menu) + { + case 1: + cout << "How much data would you like to input? "; + cin >> input; + for(a=0;a> input; + input=input-1; + cout << "Existing data\n"; + cout << "Name= " << data[input].name << endl; + cout << "Age = " << data[input].age << endl; + cout << "IPK = " << data[input].gpa << endl; + cout << "========================\n"; + cout << "New data\n"; + cout << "Name= "; + cin >> data[input].name; + cout << "Age = "; + cin >> data[input].age; + cout << "IPK = "; + cin >> data[input].gpa; + system("pause"); + cout << endl; + goto top; + case 3: + cout << "Which data would you like to see? "; + cin >> a; + cin >> b; + for(input=a-1;input +using namespace std; + +int main() +{ + int a,b,c; + cout << "Masukan a="; + cin >> a; + cout << "Masukan b="; + cin >> b; + cout << "Masukan c="; + cin >> c; + + int d=(b*b)-(4*a*c); + if(d>0) + { + cout << "X1 dan X2 bersifat riil dan berbeda" << endl; + } + else + { + if(d==0) + { + cout << "X1 dan X2 bersifat riil dan sama" << endl; + } + else + { + cout << "X1 dan X2 bersifat imaginer" << endl; + } + } + + return 0; +} \ No newline at end of file diff --git a/Fifteen.cpp b/Fifteen.cpp new file mode 100644 index 0000000..8b413aa --- /dev/null +++ b/Fifteen.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; + +int main() +{ + int x,a=0,b=0; + for(x=1;x<=100;x++) + { + if(x%3==0) + { + a=a+1; + } + else if(x%5==0) + { + b=b+1; + } + } + + cout << "Total=" << a+b; + return 0; +} \ No newline at end of file diff --git a/FuncCircleArea.cpp b/FuncCircleArea.cpp new file mode 100644 index 0000000..e560cd7 --- /dev/null +++ b/FuncCircleArea.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; + +int phi=3.14; + +float getArea(float radius); + +int main() +{ + float radius1=1,area1,area2; + area1=getArea(radius1); + cout << "Area 1= " << area1 << endl; + area2=getArea(2); + cout << "Area 2= " << area2 << endl; + cout << "Area 3= " << getArea(3) << endl; +} + +float getArea1(float radius) +{ + return radius*radius*phi; +} \ No newline at end of file diff --git a/FuncInc.cpp b/FuncInc.cpp new file mode 100644 index 0000000..0b31051 --- /dev/null +++ b/FuncInc.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; + +int inc(int n); + +int main() +{ + int n = 77; + cout << "Pass by value = " << n << endl; + int o = inc(n); + cout << "Pass by reference= " << o << endl; +} + +int inc(int n) +{ + n++; + return n; +} \ No newline at end of file diff --git a/FuncMax.cpp b/FuncMax.cpp new file mode 100644 index 0000000..18286cf --- /dev/null +++ b/FuncMax.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; + +int max(int,int); + +int main() +{ + cout << max(7,28) << endl; + + int a=6,b=9,c; + c=max(a,b); + cout << c << endl; + + cout << max(c,99) << endl; +} + +int max(int n1,int n2) +{ + return (n1>n2) ? n1:n2; +} \ No newline at end of file diff --git a/HelloWorld.cpp b/HelloWorld.cpp new file mode 100644 index 0000000..3c09656 --- /dev/null +++ b/HelloWorld.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; + +int main() +{ + cout << "Hello World! I'm coming from PYTHON SIDE!" << endl; + cout << "Welcome to the worst language EVER" << endl; + cout << "Approved by Elon Musk" << endl; + cout << "Poll by Slashdot on Twitter" < +using namespace std; + +int main() +{ + int n1,n2,a1=1,a2,a3=0; + cout << "Masukan nilai pertama= "; + cin >> n1; + cout << "Masukan nilai kedua = "; + cin >> n2; + + if(n1>0&&n2>0) + { + while(a1<=n1) + { + for(a2=1;a2<=n2;a2++) + { + a3=a3+1; + cout << "Perulangan ke-" << a3 << endl; + } + a1++; + } + } + return 0; +} \ No newline at end of file diff --git a/InsertSort.cpp b/InsertSort.cpp new file mode 100644 index 0000000..f986c1f --- /dev/null +++ b/InsertSort.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +int main(){ + int inp,temp=0; + cin >> inp; + int myArr[inp]; + int a,b,c,d; + for(a=0;a> myArr[a]; + } + for(a=1;a<=inp;a++){ + b=a-1; + temp=myArr[a]; + while(myArr[b]>temp&&b>=0){ + myArr[b+1]=myArr[b]; + b--; + } + myArr[b+1]=temp; + } + for(a=0;a +#include +using namespace std; + +int input2,input1; +int a=0,i,j,k,temp=0; +struct internet{ + long studentNumber; + long useQuota; + long useTime; +}; +internet data_main[15],data_swap[15]; + +void selectSort(int input2,internet data_main[]){ + for(i=0;i +#include +using namespace std; + +int input2,input1,query; +bool found=false; +int a=0,i,j,k,p,q,r,temp=0; +struct internet{ + long studentNumber; + long useQuota; + long useTime; +}; +internet data_main[15],data_swap[15]; + +void selectSort(int input2,internet data_main[]){ + for(i=0;i +#include +using namespace std; + +int data[100]; +int data_new[100]; + +void merge_sort(int low, int mid, int high){ + int l1,l2,i; + for(l1=low,l2=mid+1,i=low;l1<=mid&&l2<=high;i++){ + if(data[l1]<=data[l2]) + data_new[i]=data[l1++]; + else + data_new[i]=data[l2++]; + } + while(l1<=mid) + data_new[i++]=data[l1++]; + while(l2<=high) + data_new[i++]=data[l2++]; + for(i=low;i<=high;i++) + data[i]=data_new[i]; +} + +void sort(int low, int high){ + int mid; + if(low> inp; + data[inp],data_new[inp]; + int a; + for(a=0;a> data[a]; + } + sort(0,inp); + for(i=1;i<=inp;i++){ + cout << data[i] << " "; + } + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/MultiCalc.cpp b/MultiCalc.cpp new file mode 100644 index 0000000..3618fab --- /dev/null +++ b/MultiCalc.cpp @@ -0,0 +1,49 @@ +#include +using namespace std; + +int main() +{ + float x,y,z; + cout << "Masukan angka pertama:"; + cin >> x; + cout << "Masukan angka kedua :"; + cin >> y; + cout << " \n"; + cout << "Pilih mode kalkulator" << endl; + cout << "1: Penjumlahan" << endl; + cout << "2: Pengurangan" << endl; + cout << "3: Perkalian" << endl; + cout << "4: Pembagian" << endl; + cout << "Mode "; + cin >> z; + cout << " \n"; + + if(z==1) + { + float plus=x+y; + cout << "Hasil=" << plus; + } + else + { + if(z==2) + { + float minus=x-y; + cout << "Hasil=" << minus; + } + else + { + if(z==3) + { + float ply=x*y; + cout << "Hasil=" << ply; + } + else + { + float div=x/y; + cout << "Hasil=" << div; + } + } + } + + return 0; +} \ No newline at end of file diff --git a/Multiply2Arr.cpp b/Multiply2Arr.cpp new file mode 100644 index 0000000..8845626 --- /dev/null +++ b/Multiply2Arr.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; + +int ply(int a,int b) +{ + return a*b; +} + +int main() +{ + int x,y; + cin >> x; + int arr1[x]; + int arr2[x]; + cout << "Input Array 1 \n"; + for(y=0;y> arr1[y]; + } + cout << "Input Array 2 \n"; + for(y=0;y> arr2[y]; + } + cout << "Hasil" << endl; + for(y=0;y +#include +using namespace std; + +int input2,input1; +int a=1,b,c,i,j,k,temp=0; +bool found=false; +struct student{ + long double studentNumber; + string studentName; + int studentScore; +}; +student data_main[100],data_swap[100]; + +void insertSortNISN(int input2,student data_main[]){ + for(j=1;jtemp&&i>=0){ + data_main[i+1]=data_main[i]; + i--; + } + data_main[i+1]=data_swap[0]; + } +} +void insertSortNilai(int input2,student data_main[]){ + for(j=1;jtemp&&i>=0){ + data_main[i+1]=data_main[i]; + i--; + } + data_main[i+1]=data_swap[0]; + } +} + +void selectSortNISN(int input2,student data_main[]){ + for(i=0;idata_main[j+1].studentNumber){ + data_swap[0]=data_main[j]; + data_main[j]=data_main[j+1]; + data_main[j+1]=data_swap[0]; + } + } + } +} +void bubbleSortNilai(int input2,student data_main[]){ + for(i=0;idata_main[j+1].studentScore){ + data_swap[0]=data_main[j]; + data_main[j]=data_main[j+1]; + data_main[j+1]=data_swap[0]; + } + } + } +} + +void mergeSwapNISN(int low,int mid,int high,student data_main[],student data_swap[]){ + int l1,l2,i; + for(l1=low,l2=mid+1,i=low;l1<=mid&&l2<=high;i++){ + if(data_main[l1].studentNumber<=data_main[l2].studentNumber){ + data_swap[i]=data_main[l1++];} + else{ + data_swap[i]=data_main[l2++];} + } + while(l1<=mid){ + data_swap[i++]=data_main[l1++];} + while(l2<=high){ + data_swap[i++]=data_main[l2++];} + for(i=low;i<=high;i++){ + data_main[i]=data_swap[i];} +} +void mergeSortNISN(int low,int high,student data_main[],student data_swap[]){ + int mid; + if(low +using namespace std; + +int main() +{ + int x; + cout << "Masukan sebuah angka" << endl; + cin >> x; + + if (x%2==0) + { + cout << "Angka Genap"; + } + else + { + cout << "Angka Ganjil"; + } + return 0; +} \ No newline at end of file diff --git a/POSRev1.cpp b/POSRev1.cpp new file mode 100644 index 0000000..c0d7323 --- /dev/null +++ b/POSRev1.cpp @@ -0,0 +1,67 @@ +#include +using namespace std; + +struct bargains +{ + string productcode; + string productname; + float price; + float count; +}; + +int main() +{ + int input,much=0,a; + float total=0,totalsum=0,average,money,exchange; + cout << "======= === ======\n"; + cout << "= = = = =\n"; + cout << "= = = = =\n"; + cout << "= = = = =\n"; + cout << "= = = = ==\n"; + cout << "===== = = ===\n"; + cout << "= = = =\n"; + cout << "= = = =\n"; + cout << "= = = =\n"; + cout << "= === ======\n"; + cout << "Point Of Sales\n"; + cout << endl; + cout << "How much product do you buy? "; + cin >> input; + cout << endl; + bargains data[input]; + for(a=0;a> data[a].productcode; + cout << "Product Name: "; + cin >> data[a].productname; + cout << "Price : "; + cin >> data[a].price; + cout << "Count : "; + cin >> data[a].count; + cout << "=========================================\n"; + much=data[a].count+much; + total=data[a].price*data[a].count+total; + totalsum=total+totalsum; + } + cout << endl; + average=totalsum/much; + cout << "Total Products = " << much << endl; + cout << "Total Bill = " << totalsum << endl; + cout << "Average Bill per Product= " << average << endl; + cout << endl; + cout << "Your money = "; + cin >> money; + exchange=money-totalsum; + if(exchange<0) + { + cout << "Kurang duitnya cuk!" << endl; + } + else + { + cout << "Your exchange= " << exchange << endl; + } + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/Pecahan.cpp b/Pecahan.cpp new file mode 100644 index 0000000..9d841c2 --- /dev/null +++ b/Pecahan.cpp @@ -0,0 +1,17 @@ +#include +#include +using namespace std; + +int main() +{ + int input,x; + float y=0,z=0; + cin >> input; + for(x=1;x<=input;x++) + { + y=x/(pow(2,x)); + z=y+z; + } + cout << z << endl; + return 0; +} \ No newline at end of file diff --git a/Point1.cpp b/Point1.cpp new file mode 100644 index 0000000..81f0b65 --- /dev/null +++ b/Point1.cpp @@ -0,0 +1,24 @@ +#include +#include +using namespace std; + +int main() +{ + int x=3,y=4; + int *ip; + ip=&x; + y=*ip; + x=10; + *ip=3; + printf("x=%d,y=%d,x,y"); + cout << endl; + cout << endl; + int a=0,b=0; + int *f; + f=&a; + *f=3; + cout << *f << endl; + *f=a+4; + cout << *f; + return 0; +} \ No newline at end of file diff --git a/Point1.exe b/Point1.exe new file mode 100644 index 0000000000000000000000000000000000000000..c61b3a75feaf254cf075738a821544d04240823f GIT binary patch literal 44703 zcmeHw3w%`7x$l}68A!+^5EK=4ut7l~Bp5K*(9UEsd1zi{5*`X}LNbA9UM72Zs7P=o zmVKt_p{;E_=h}Ouc+TPUdaOO=L|Uy41QSrIfl{SnJ*cP?LtAPU16b$&zqR(BJv)=o zbNf5L-@W&=`;)j=C0SeO+s7o9tZYcXk9?olULI!b+dBrLDoAHFfHg zOqFz%m$5R_RQ8SUe{vVw$XJeZ);7h_I=O9iM54)r2#x)`fU63IX3zx4^mW{y*E^L79s%0x$&?B6USb96rb zkwBztObMiMtYuYevl{B;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Xxz#7| z6RO;{<_4-(y?QrbmL!Q6R#?_1f8D)V@RTvlp8Sl!-V#ZKiUMzOX$3c|Xb=)qqNGz z=$c}3#yb}5>xP}n<2{~NjQY)hN85?m+@m08{PKT?Ag!z6#jDuyj=X3kJ!r}TYAy1_ox|2qVLo%Tw0?? zOD$UOAZoBarm`60H261PqVoCv^P(F7$vd0S0ZG`kNC@2}? zHf=SinR)Ck`kHHrz5ltJ}O)cd8MXS<`gfz&g$-A@(Z_vEVs&h|as|ONLL?s2Ez0_e&hy zDzV>p7!&&9J3!%MvaTJJZ9y9@Kof>qde2C`rPdH=MyiRP_)D@Ah|N7)3~M78t(2NPJhRUZ&qB=;b88d+8mYQ%pdg-7uVaGhSZ%g +#include +using namespace std; + +int main() +{ + int count=16,sum=17,*x,*y; + x=∑ + *x=27; + y=x; + x=&count; + *x=count; + printf("count=%d,sum=%d,*x=%d,*y=%d\n",count,sum,*x,*y); + return 0; +} \ No newline at end of file diff --git a/Point4.cpp b/Point4.cpp new file mode 100644 index 0000000..719bbc3 --- /dev/null +++ b/Point4.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace std; + +int main() +{ + int var_x=273; + int *ptr1; + int **ptr2; + ptr1=&var_x; + ptr2=&ptr1; + printf("Nilai var_x=*ptr1 =%d\n", *ptr1); + printf("Nilai var_x=**ptr2 =%d\n", **ptr2); + printf("ptr1=&var_x =%p\n", ptr1); + printf("&ptr2=&ptr1 =%p\n", ptr2); + printf("&ptr2 =%p\n", &ptr1); + return 0; +} \ No newline at end of file diff --git a/Pointer.cpp b/Pointer.cpp new file mode 100644 index 0000000..e0eba34 --- /dev/null +++ b/Pointer.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; + +void swap(int &x,int &y) +{ + int z=x; + x=y; + y=z; +} + +int main() +{ + char satu[]={"Praktikum Pemrograman"}; + char *p; + p=&satu[0]; + cout << p << endl; + + char dua[]={"Gadjah Mada"}; + char *q; + *q=dua[3]; + cout << *q << endl; + + int x,y; + x=90,y=76; + cout << x << " " << y << endl; + swap(x,y); + cout << x << " " << y << endl; + + return 0; +} \ No newline at end of file diff --git a/Pythagoras.cpp b/Pythagoras.cpp new file mode 100644 index 0000000..d35742a --- /dev/null +++ b/Pythagoras.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace std; + +int main() +{ + float x,y,z,a; + cout << "Sisi Pertama="; + cin >> x; + cout << "Sisi Kedua="; + cin >> y; + + z=(x*x)+(y*y); + a=sqrt(z); + cout << a << endl; + + return 0; +} \ No newline at end of file diff --git a/QuikSort.cpp b/QuikSort.cpp new file mode 100644 index 0000000..a1880a3 --- /dev/null +++ b/QuikSort.cpp @@ -0,0 +1,52 @@ +#include +#include +using namespace std; + +int data[100]; +int input,a; + +void swap(int *a,int *b){ + int c=*a; + *a=*b; + *b=c; +} + +int partition(int data[],int low,int high){ + int pivot=data[high]; + int i=(low-1); + for(int j=low;j<=high-1;j++){ + if(data[j]<=pivot){ + i++; + swap(&data[i],&data[j]); + } + } + swap(&data[i+1],&data[high]); + return (i+1); +} + +void quicksort(int data[],int low,int high){ + if(low=60) + { + cout << "B" << endl; + } + else + { + if(x>=40) + { + cout << "C" << endl; + } + else + { + if(x>=20) + { + cout << "D" << endl; + } + else + { + cout << "E" << endl; + } + } + } + } + + return 0; +} diff --git a/SelectSort.cpp b/SelectSort.cpp new file mode 100644 index 0000000..d5500eb --- /dev/null +++ b/SelectSort.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +int main(){ + int inp,temp,min,a=0,b,c,d; + cin >> inp; + int myArr[inp]; + for(a=0;a> myArr[a]; + } + for(a=0;a +using namespace std; + +int main() +{ + bool found=false; + char* name[]={"A","B","C","D","E","F"}; + char* number[]={"121","122","123","124","125","126"}; + char* query="123"; + float score[]={64.75,75.11,84.63,77.07,66.70,92.76}; + for(int i=0;i<6;i++) + { + if(number[i]==query) + { + cout << name[i] << " " << number[i] << " " << score[i] << endl; + found=true; + } + } + if(!found) + { + cout << "No data found"; + } + return 0; +} \ No newline at end of file diff --git a/SoalBinus.cpp b/SoalBinus.cpp new file mode 100644 index 0000000..7399bc6 --- /dev/null +++ b/SoalBinus.cpp @@ -0,0 +1,54 @@ +#include +using namespace std; + +int main() +{ + int x,y,z,i=0,a,b,c,d; + cin >> x; + int rep[x]; + int cnt[x]; + while(i> y; + int larik[y]; + cin >> a; + for(z=0;zRepeat) + { + Repeat=repeat; + count=larik[z]; + } + } + else + { + repeat=0; + } + } + Repeat++; + rep[i]=Repeat; + cnt[i]=count; + i++; + } + for(i=0;i +using namespace std; + +int main() +{ + int max,b; + cout << "Masukan sebuah angka=" << endl; + cin >> b; + + if(max>b) + { + max=b; + } + else + { + b=max+b; + } +} \ No newline at end of file diff --git a/TheLoop.cpp b/TheLoop.cpp new file mode 100644 index 0000000..3628b91 --- /dev/null +++ b/TheLoop.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; + +long double x; +int main() +{ + cout << "Start THE LOOP" << endl; + cin >> x; + for(int y=1;y>0;y++) + { + x=x*x; + cout << x << endl; + } + + return 0; +} \ No newline at end of file diff --git a/Training2.cpp b/Training2.cpp new file mode 100644 index 0000000..62ec597 --- /dev/null +++ b/Training2.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +int main() +{ + int a,b,c,d,e; + cout << "Type First Number \n"; + cin >> a; + cout << "Type Second Number \n"; + cin >> b; + cout << "Type Third Number \n"; + cin >> c; + cout << "Type Fourth Number \n"; + cin >> d; + cout << "Type Fifth Number \n"; + cin >> e; + + int multiply=a*b*c*d*e; + cout << multiply << endl; + + return 0; +} \ No newline at end of file diff --git a/Training4.cpp b/Training4.cpp new file mode 100644 index 0000000..f964d1d --- /dev/null +++ b/Training4.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; + +int main() +{ + for (int q = 0;q <= 100;q+=2) + { + cout << q << endl; + } + + return 0; +} \ No newline at end of file diff --git a/TriSqrCirc.cpp b/TriSqrCirc.cpp new file mode 100644 index 0000000..e1e90e7 --- /dev/null +++ b/TriSqrCirc.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; + +float phi=3.14; +float high; +float getArea1(float rad) +{ + return rad*high/2; +} +float getArea2(float rad) +{ + return rad*rad*phi; +} +float getArea3(float rad) +{ + return rad*rad; +} + +int main() +{ + float rad1,rad2,rad3; + cout << "Input for Triangle \n"; + cin >> rad1; + cin >> high; + cout << "Input for Circle \n"; + cin >> rad2; + cout << "Input for Square \n"; + cin >> rad3; + cout << "Triangle= " << getArea1(rad1) << endl; + cout << "Circle = " << getArea2(rad2) << endl; + cout << "Square = " << getArea3(rad3) << endl; + system("pause"); +} \ No newline at end of file diff --git a/TriStar.cpp b/TriStar.cpp new file mode 100644 index 0000000..806c8db --- /dev/null +++ b/TriStar.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; + +void tristar(int inp); +int x,a,b; + +int main() +{ + int inp; + cin >> inp; + tristar(inp); +} + +void tristar(int inp) +{ + for(x=1;x<=inp;x++) + { + a=inp-x; + b=0; + while(a>0) + { + cout << " "; + a--; + } + while(b +using namespace std; + +int main() +{ + int a,b; + cout << "Ini adalah kalkulator volume tabung" << endl; + cout << "Masukan jari-jari tabung= "; + cin >> a; + cout << "Masukan tinggi tabung = "; + cin >> b; + cout << " \n"; + + int v=3.14*a*a*b; + cout << "Volume Tabung = " << v << endl; + + system("pause"); + return 0; +} \ No newline at end of file diff --git a/TwotheBiggest.cpp b/TwotheBiggest.cpp new file mode 100644 index 0000000..b5ed12e --- /dev/null +++ b/TwotheBiggest.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; + +int main() +{ + int z,x; + cout << "First number please" << endl; + cin >> z; + cout << "Second please" << endl; + cin >> x; + + if (z>x) + { + cout << "First Number is the biggest"; + } + else + { + cout << "Second Number is the biggest"; + } + return 0; +} \ No newline at end of file diff --git a/WeirdLog.cpp b/WeirdLog.cpp new file mode 100644 index 0000000..1eb82db --- /dev/null +++ b/WeirdLog.cpp @@ -0,0 +1,22 @@ +#include +#include +using namespace std; + +int main() +{ + int a; + cin >> a; + int b=a+2; + if(b>4) + { + float c=log(a+b); + cout << a << "," << c; + } + else + { + float c=b*b*b*b*b; + cout << a << "," << c; + } + + return 0; +} \ No newline at end of file diff --git a/Who'sBiggest.cpp b/Who'sBiggest.cpp new file mode 100644 index 0000000..c5e4af3 --- /dev/null +++ b/Who'sBiggest.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; + +int main() +{ + int a,b,c; + cout << "Masukan angka pertama="; + cin >> a; + cout << "Masukan angka kedua="; + cin >> b; + cout << "Masukan angka ketiga="; + cin >> c; + + if(a>b) + { + if(a>c) + { + cout << "Bilangan pertama adalah yang terbesar" << endl; + } + else + { + cout << "Bilangan ketiga adalah yang terbesar" << endl; + } + } + else + { + if(b>c) + { + cout << "Bilangan kedua adalah yang terbesar" << endl; + } + else + { + cout << "Bilangan ketiga adalah yang terbesar" << endl; + } + } + + return 0; +} \ No newline at end of file diff --git a/YourID.cpp b/YourID.cpp new file mode 100644 index 0000000..2d72e4a --- /dev/null +++ b/YourID.cpp @@ -0,0 +1,21 @@ +#include +#include +using namespace std; + +string a, b, c; +int main() +{ + cout << "Masukan Nama Lengkap" << endl; + getline (cin,a); + cout << "Masukan NIM" << endl; + getline (cin,b); + cout << "Masukan Alamat" << endl; + getline (cin,c); + + cout << "Data Anda" << endl; + cout << a << endl; + cout << b << endl; + cout << c << endl; + + return 0; +} \ No newline at end of file