WFandella
Tuesday, June 4, 2013
Contoh Program Exception Handling C++ (1)
#include<iostream>
using namespace std;
int main(){
double X;
try{
cout<<"masukan sebuah bilangan bulat positif : ";
cin>>X;
if(X<=0)
{
throw X;
}else{
cout<<"Nilai yang di masukan adalah : "<<X;
}
}
catch(double E){
cout<<"program telah menangkap ekspesi yang bernilai : ";
cout<<E;
}
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Link
Contoh Program Menu Linked List, Insert Kiri, Insert Kanan, Hapus Depan, Hapus Belakang (Struktur Data)
#include<iostream.h> #include<conio.h> #include<stdio.h> #include<alloc.h> void buat_baru(); void insert_kiri(...
Mencari Nilai Terkecil Array (C++)
#include<stdio.h> #include<conio.h> int main(void){ int nilai[3];
"Username & Password" (Contoh Program C++)
#include <iostream.h> #include <conio.h> main (void) { int username, password;
No comments:
Post a Comment