1. Buatlah program yang menampilkan biodata pribadi anda.
Program C++
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
char n[20],a [50],ttl[20],c[20],h[50];
cout<<"\t\t\t\tSelamat Datang Di Program Input Biodata\n\n"<<endl;
cout<<"Nama : ";
cin>>n;
cout<<"Alamat : ";
cin>>a;
cout<<"TTL : ";
cin>>ttl;
cout<<"Hobi : ";
cin>>h;
cout<<"Cita-cita : ";
cin>>c;
cout<<"\n\n\t\t Biodata Diri \n";
cout<<"Nama :"<<n<<"\nAlamat :"<<a
<<"\nTTL : "<<ttl
<<"\nHobi"<<h<<"\nCita-cita :"<<c<<endl;
return 0;
}
HASIL DARI RAPTOR
2. buatlah program yang meminta input dari user berupa tanggal, bulan dan tahun kelahiran
dan menampilkannya dengan format tanggal-bulan-tahun.
Program C++
#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int tgl,bln,thn;
cout<<"Masukkan Tanggal : ";
cin>>tgl;
cout<<"Masukkan Bulan : ";
cin>>bln;
cout<<"Masukkan Tahun : ";
cin>>thn;
cout<<"\n\t"<<tgl<<"-"<<bln<<"-"<<thn<<endl;
return 0;
}
HASIL DARI RAPTOR
Belum ada tanggapan untuk "DIKTAT ALPRO (BAB 1)"
Posting Komentar