ini merupakan program membuat atau menampilkan kalender sederhana di dalam C++, bagi kawan -kawan yang ingin mencoba program ini, silahkan copy paste aja di C++ buildernya,,,, okok gan!!!!!!
nie shource codenya:
//---------------------------------------------------------------------------
#include <vcl\condefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USERES("Project1.res");
//---------------------------------------------------------------------------
int main(int argc, char **argv)
//void main()
{
int i,j,n,y,max,sisa;
int jum_hari[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// char bulan[12] = {“JANUARI”,”PEBRUARI”,”MARET”,”APRIL”,”MEI”,”JUNI”,”JULI”,”AGUSTUS”,”SEPTEMBER”,”OKTOBER”,”NOPEMBER”,”DESEMBER”};
printf("Input Tanggal 1 Pada Hari ke : ");
scanf("%d",&n);
printf("Tahun : ");
scanf("%d",&y);
printf("\n");
for(i=0;i<12;i++){
int z=1,c=1;
// printf(“Bulan : %sn”,bulan[0]);
printf("Bulan Ke : %d\n",i+1);
printf ("SEN SEL RAB KAM JUM SAB MING \n");
if(jum_hari[1]==28){
jum_hari[1] = y%4 == 0? 29:28; //cek jumlah hari kabisat atau bukan
}
//atur posisi tanggal 1
for(j=0;j<jum_hari[i]+n;j++){
if(j<n-1){
printf(" ");
}
else if(j>=n){
printf("%3d ",z);
z++;
}
if(j%7==0 && j!=0){
printf("j : %d\n",j);
c++;
}
}
max = 7*c;
sisa=max-j;
n=7-sisa;
printf("\n\nmak : %d sisa : %d j : %d \n : %d\n",max,sisa+1,j-1,n);
printf("n\n");
}
getch ();
}
nie shource codenya:
//---------------------------------------------------------------------------
#include <vcl\condefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USERES("Project1.res");
//---------------------------------------------------------------------------
int main(int argc, char **argv)
//void main()
{
int i,j,n,y,max,sisa;
int jum_hari[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// char bulan[12] = {“JANUARI”,”PEBRUARI”,”MARET”,”APRIL”,”MEI”,”JUNI”,”JULI”,”AGUSTUS”,”SEPTEMBER”,”OKTOBER”,”NOPEMBER”,”DESEMBER”};
printf("Input Tanggal 1 Pada Hari ke : ");
scanf("%d",&n);
printf("Tahun : ");
scanf("%d",&y);
printf("\n");
for(i=0;i<12;i++){
int z=1,c=1;
// printf(“Bulan : %sn”,bulan[0]);
printf("Bulan Ke : %d\n",i+1);
printf ("SEN SEL RAB KAM JUM SAB MING \n");
if(jum_hari[1]==28){
jum_hari[1] = y%4 == 0? 29:28; //cek jumlah hari kabisat atau bukan
}
//atur posisi tanggal 1
for(j=0;j<jum_hari[i]+n;j++){
if(j<n-1){
printf(" ");
}
else if(j>=n){
printf("%3d ",z);
z++;
}
if(j%7==0 && j!=0){
printf("j : %d\n",j);
c++;
}
}
max = 7*c;
sisa=max-j;
n=7-sisa;
printf("\n\nmak : %d sisa : %d j : %d \n : %d\n",max,sisa+1,j-1,n);
printf("n\n");
}
getch ();
}