#include
# include
# include
# include
# include
void tunggu(void)
{
long int i;
for(i=0; i<6e6; t="6,lo;" abjad="'A';" silahkan="" ketikan="" 0x1="" untuk="" mulai="" menampilkan="" cout=""><<" "; cin>>bil;
if(bil>0 && bil<=1){ bil=bil-1; A[1]=1; A[2]=1; } //operasi pengulangan tampil: clrscr(); textcolor(90); abjad='A'; cout<<<"Program Menampilkan Huruf Abjad (A-Z)";cout<<<<<"."; tunggu(); x=9+i; y=6; gotoxy(x,y); cout<<" "; tunggu(); i++; } while(i<7); i="0;" x="15-i;" y="6;" x="15-i;" y="6;"><<"__H u r u f A b j a d (A-Z)__";cout<<<<<<<"\a"; cout<<" "; abjad++; }while(abjad<='Z'); cout<<<<<<<<<<<<<<<<"R"<<"\a"<<"a"<<"\a"<<"w"<<"\a"<<"i"<<"\a"<<"k"<<"\a"<<"o"<<"\a"<<" "; cout<<"\a"<<"E"<<"\a"<<"r"<<"\a"<<"i"<<"\a"<<"a"<<"\a"<<"d"<<"\a"<<"i"<<<<"8"<<"\a"<<"0"<<"\a"<<"2"<<"\a"<<"0"<<"\a"<<"0"; cout<<"\a"<<"9"<<"\a"<<"0"<<"\a"<<"1"<<"\a"<<"9"<<"\a"<<"8."; cout<<<>jwb;
if (jwb=='y' || jwb=='Y'){
A[3]=1;
t=6;
goto tampil;
}
clrscr();
cout<<<<<<<<
textcolor(140); cout<<" ";
cprintf(" T e r i m a k a s i h "); cout<
cout<<" ";
cout<<"=======================";
getch();
}
pemrograman C++
my_frend
Kamis, 20 Mei 2010
Senin, 17 Mei 2010
program pengecekan bilangan prima
//program menentukan bilangan prima
#include "iostream.h"
# include "iomanip.h"
# include "string.h"
# include "conio.h"
# include "stdio.h"
void tunggu(void)
{
long int i;
for(i=0; i<6e6; i++); } main() { int bil,n=2,p,k=1,bilj=0,lo,y,x,ket,kl=1; char lagi; awal: if (kl==2){ textcolor(175); }else if(kl==3){ textcolor(90); }else if(kl==4){ textcolor(20); }else if(kl>=5){
textcolor(25);
}
clrscr();
cout<
textcolor(145);
cout<
textcolor(10);
}
do
{
x=40+i; y=11;
gotoxy(x,y);
cout<<"."; tunggu(); x=40+i; y=11; gotoxy(x,y); cout<<" "; tunggu(); i++; }while(i<18); cprintf(" Please wait....."); if(bil>=0){
i=0;
do
{
x=75-i; y=11;
gotoxy(x,y);
textcolor(55);
cprintf(".");
tunggu();
x=75-i; y=11;
gotoxy(x,y);
cout<<" "; tunggu(); i++; }while(i<18); } } } if (bil<=2){ cout<<" Bilangan itu prima."<
for(p=1;p<=k;p++){ bilj=bil%n; if (bilj==0){ cout<<" Bukan bilangan prima."<
if (lagi=='y' || lagi=='Y'){
bil=0;
n=2;
k=1;
kl++;
goto awal;
}
clrscr();
cout<
program pengecekan bilangan prima
//program menentukan bilangan prima
#include
# include
# include
# include
# include
void tunggu(void)
{
long int i;
for(i=0; i<6e6; n="2,p,k="1,bilj="0,lo,y,x,ket,kl="1;" kl="="2){" kl="="3){" kl="="4){">=5){
textcolor(25);
}
clrscr();
cout<
textcolor(145);
cout<
textcolor(10);
}
do
{
x=40+i; y=11;
gotoxy(x,y);
cout<<"."; tunggu(); x=40+i; y=11; gotoxy(x,y); cout<<" "; tunggu(); i++; }while(i<18);>=0){
i=0;
do
{
x=75-i; y=11;
gotoxy(x,y);
textcolor(55);
cprintf(".");
tunggu();
x=75-i; y=11;
gotoxy(x,y);
cout<<" "; tunggu(); i++; }while(i<18); else="" if="" bil="">2){
for(p=1;p<=k;p++){ bilj=bil%n; if (bilj==0){ cout<<" Bukan bilangan prima."<
if (lagi=='y' || lagi=='Y'){
bil=0;
n=2;
k=1;
kl++;
goto awal;
}
clrscr();
cout<
program menampilkan bilangan ganjil
# include
# include
# include
void main ()
{
int bil,h,hasil;
char lagi;
clrscr();
cout<<" Program menampilkan bilangan ganjil dari 1-100"< cout<<" =============================================="< for (h=1;h<=100 ;h++){
if ((h%2)!=0){
cout< }
}
cout< textcolor(190);
cprintf(" Ketik [y] untuk melakukan operasi cek bilangan ganjil secara manual,");cout< cout<<" lakukan operasi [y/t] : "; cin>>lagi;
if (lagi=='y' || lagi=='Y'){
goto awal;
}else{
goto sel;
}
awal:
clrscr();
cout< cout<<" Inputkan nilai yang akan di cek : "; cin>>bil;
cout< if ((bil%2)!=0){
cout< }else{
cout< }
cout< cprintf(" Lakukan operasi lagi [y/t] : "); cin>>lagi;
if (lagi=='y' || lagi=='Y'){
goto awal;
}else{
goto sel;
}
sel:
clrscr();
cout< cout< cout< getch();
}
# include
# include
void main ()
{
int bil,h,hasil;
char lagi;
clrscr();
cout<<" Program menampilkan bilangan ganjil dari 1-100"<
if ((h%2)!=0){
cout<
}
cout<
cprintf(" Ketik [y] untuk melakukan operasi cek bilangan ganjil secara manual,");cout<
if (lagi=='y' || lagi=='Y'){
goto awal;
}else{
goto sel;
}
awal:
clrscr();
cout<
cout<
cout<
cout<
cout<
if (lagi=='y' || lagi=='Y'){
goto awal;
}else{
goto sel;
}
sel:
clrscr();
cout<
}
program menghitung nilai
// contoh program menghitung nilai rata-rata
#include
#include
#include
void main ()
{
int pencacah=0 ,l=1 ;
float nilai, total=0;
char lagi;
awal:
clrscr();
cout <<< "Menghitung Nilai rata-rata Nilai SMPN X" <<><< "_______________________________________" <<><=0)
{
cout <<" Nilai siswa "<<<" : "; cin >> nilai;
pencacah++;
if (nilai<0){>=0){
total += nilai;
}
}
//menampilkan hasil.
cout<<" ----------------------------------"<<<" Jumlah dari semua nilai : "<<<<<" Nilai rata-rata : " <<><<<<<<<<" "; cout<<" Lakukan perhitungan lagi [y/t] : "; cin>>lagi;
if (lagi=='y' || lagi=='Y'){
total=0;
pencacah=0;
nilai=0;
l=1;
goto awal;
}
getch();
}
#include
#include
#include
void main ()
{
int pencacah=0 ,l=1 ;
float nilai, total=0;
char lagi;
awal:
clrscr();
cout <
{
cout <<" Nilai siswa "<
pencacah++;
if (nilai<0){>=0){
total += nilai;
}
}
//menampilkan hasil.
cout<<" ----------------------------------"<
if (lagi=='y' || lagi=='Y'){
total=0;
pencacah=0;
nilai=0;
l=1;
goto awal;
}
getch();
}
Langganan:
Postingan (Atom)