Senin, 17 Maret 2014

Pertemuan 03: Tugas Individu PPT 3.5


3.5 Konversi Hari


A. Analisis

a. Algoritma  {Membaca masukkan nilai d
lalu mencetak hasil outputnya}
b. Deklarasi 
d :Integer
c. Deskripsi 
read (d)
if (d==1) then write ( ‘senin’)
else if (d==2)then write (‘selasa’)
else if (d==3)then write (‘rabu’)
else if (d==4)then write (‘kamis’)
else if (d==5)then write (‘jumat’)
else if (d==6)then write(‘sabtu’)
else if (d==7)then  write(‘minggu’)
else write (‘no day’)
end if















B. Flowchart
 https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqoEpDtBUKxhbiD6x74BcPvwsUXnIctaTpgaVhZr3fhYkIeAcB5ItsXkNfxT1EvsHRBwc2JNVwSutcPKe8V5qWWsB4itdN4pGQPmSe1PD9PmbU0BSrAcug9PgV8c_wS16lZEi-Can5-51S/s1600/konversi+hari+rap.JPG


C. Bahasa C++


#include <iostream>
#include <cstdlib>
using namespace std;

class Konversi{
 friend ostream& operator<<(ostream&, Konversi&);
 friend istream& operator>>(istream&, Konversi&);
 public:
 Konversi(){};
 void day(){
 if (d==1){
 cout << "monday" << endl; }
 else if (d==2){
 cout << "tuesday" << endl; }
 else if (d==3){
 cout << "wednesday" << endl; }
 else if (d==4){
 cout << "thursday" << endl; }
 else if (d==5){
 cout << "friday" << endl; }
 else if (d==6){
 cout << "saturday" << endl; }
 else if (d==7){
 cout << "sunday" << endl; }
 else{
 cout << "no day" << endl; }}

 private:
 int d;
 };
 istream& operator>>(istream& in, Konversi& input){
 cout<<"Program tentang Konversi Hari"<<endl;
 cout<<"Input day :";in>>input.d;
 return in;
 }
 ostream& operator<<(ostream& out, Konversi& output){
 out<<"day"<<output.d<<"is"<<output.d;
 return out;
 }
int main()
{ Konversi x;
 cin>>x;
 x.day();
 cout<<endl;
 system("PAUSE");
 return EXIT_SUCCESS;
}


https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidueOX6PuVzu-fJcDxmyDfzo0ZhAew9_bDs5qGRkgioHOJg7m4epxAe2qlq3P2AwQK0bycFd2Xui94l9s-Dmazn9fSpUZgJhYt53UG0xdp3hU2PXTi2qUtxaJivKd_QlMvEV3WCpC4pMte/s1600/konversi+hari+ddp.JPG

Mengerjakan Alpro sungguh-sungguh sangat menyita waktu dan tenaga saya, sumpah laah !!
hampir matakuliah lain tidak terlirik, tiap hati hanya ALPRO ALPRO DAN ALPRO. Terimakasih :*
 



Tidak ada komentar:

Posting Komentar