Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Jawaban Ujian : C++ Tipe A

Nah kalau yang ini merupakan pembahasan ujian tipe A.

Listing Programnya.

#include "conio.h"
#include "stdio.h"
#include "iostream.h"
#include "string.h"
struct datarumah{
	char nama[30];
	char tipe[3] ;
	double uang    ;
	int  jumlah  ;
} recrumah[10] ;

void main() {
	long harga ;
	int hasil ;
	double tharga, sisa ;
	char pil ;
	char nama[20];
	int j, i=0 ;
	pil='Y' ;

	while(pil=='Y'||pil=='y'){
		  clrscr() ;
		  gotoxy(30,4) ; cout<< "Inputkan Rumah"  ;
		  gotoxy(30,5) ; cout<< "---------------------------"  ;
		  gotoxy(30,6) ; cout<< "Nama Pembeli : "  ; cin >> recrumah[i].nama ;
		  gotoxy(30,7) ; cout<< "Tipe Rumah   : "  ; cin >> recrumah[i].tipe ;
		  gotoxy(30,8) ; cout<< "Jumlah       : "  ; cin >> recrumah[i].jumlah;
		  gotoxy(30,9) ; cout<< "Uang Muka    : "  ; cin >> recrumah[i].uang;

		  gotoxy(30,11); cout<< "Input Data Lagi : "  ; pil = getch() ;
		  i++ ;
	}
	clrscr() ;
	gotoxy(2,2) ; cout<< "PT. SMARTHOME"  ;
	gotoxy(2,3) ; cout<< "Laporan Penjualan Rumah"  ;
	gotoxy(2,4) ; cout<< "-------------------------------------------------------------------------------"  ;
	gotoxy(2,5) ; cout<< "No Nama       Type  Keterangan     Harga     Jumlah Uang Muka   Sisa Pembayaran "  ;
	gotoxy(2,6) ; cout<< "-------------------------------------------------------------------------------"  ;
	for(j=0 ; j<i ; j++){
		  strcpy(nama,"---") ;
		  harga = 0 ;

		  hasil = strcmp(recrumah[j].tipe,"R21") ;
		  if(hasil==0){
				strcpy(nama,"Rumah KT2&KM1") ;
				harga = 60000000 ;
		  }

		  hasil = strcmp(recrumah[j].tipe,"R31") ;
		  if(hasil==0){
				strcpy(nama,"Rumah KT3&KM1") ;
				harga = 80000000 ;
		  }
		  hasil = strcmp(recrumah[j].tipe,"R32") ;
		  if(hasil==0){
				strcpy(nama,"Rumah KT3&KM2") ;
				harga = 95000000 ;
		  }

		  tharga = harga * recrumah[j].jumlah ;
		  sisa = tharga - recrumah[j].uang ;

		  gotoxy(3,7+j) ; cout<< j+1 << " " << recrumah[j].nama ;
		  gotoxy(16,7+j) ; cout<< recrumah[j].tipe ;
		  gotoxy(22,7+j) ; cout<< nama ;
		  gotoxy(37,7+j) ; cout<< harga;
		  gotoxy(47,7+j) ; cout<< recrumah[j].jumlah ;
		  gotoxy(54,7+j) ; cout<< recrumah[j].uang ;
		  gotoxy(66,7+j) ; cout<< sisa ;
	}
	gotoxy(2,8+j) ; cout<< "-------------------------------------------------------------------------------"  ;
}

Filed under: C/C++, Ujian, ,

Terima kasih telah memberikan komentar anda.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives Per Tahun

Sponsored

C&C Online Shop

Blog Stats

  • 355,909 sejak 12 Jan 2011

User’s Online


My Music

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 223 other followers

May 2011
M T W T F S S
« Apr   Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
%d bloggers like this: