Skip to content

Commit

Permalink
Update Nov'18
Browse files Browse the repository at this point in the history
  • Loading branch information
debugvelop authored Nov 27, 2018
1 parent 1db5c76 commit fd734cd
Show file tree
Hide file tree
Showing 62 changed files with 2,506 additions and 33 deletions.
32 changes: 32 additions & 0 deletions 3-11.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <iostream>
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;
}
23 changes: 23 additions & 0 deletions 3-13.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
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;
}
29 changes: 29 additions & 0 deletions 3-14.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>
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;
}
32 changes: 32 additions & 0 deletions 3-15.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <iostream>
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;
}
24 changes: 24 additions & 0 deletions 3-16.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
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;
}
33 changes: 33 additions & 0 deletions 3-41.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <iostream>
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;
}
19 changes: 19 additions & 0 deletions 4-41.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <iostream>
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;
}
21 changes: 21 additions & 0 deletions 4-42.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <iostream>
#include <string.h>
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;
}
82 changes: 82 additions & 0 deletions 4-43.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#include <iostream>
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(y<star1)
{
cout << "* ";
y++;
}
cout << endl;
}
cout << endl;
cout << "STAR 2" << endl;
for(star2=1;star2<=limit;star2++)
{
x=1;
y=0;
while(x<star2)
{
cout << " ";
x++;
}
while(y<=limit-star2)
{
cout << "* ";
y++;
}
cout << endl;
}
cout << endl;
cout << endl;
cout << "STAR 3" << endl;
for(star1=1;star1<limit;star1++)
{
x=limit-star1;
y=0;
while(x>0)
{
cout << " ";
x--;
}
while(y<star1)
{
cout << "* ";
y++;
}
cout << endl;
}
for(star2=1;star2<=limit;star2++)
{
x=1;
y=0;
while(x<star2)
{
cout << " ";
x++;
}
while(y<=limit-star2)
{
cout << "* ";
y++;
}
cout << endl;
}
cout << endl;

system("pause");
return 0;
}
48 changes: 48 additions & 0 deletions 4-44.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <iostream>
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;
}
22 changes: 22 additions & 0 deletions 5-41.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>
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<n;x++)
{
cin >> plus[x];
}
for(x=0;x<n;x++)
{
sum=sum+plus[x];
}
cout << sum << endl;

system("pause");
return 0;
}
Loading

0 comments on commit fd734cd

Please sign in to comment.