#include <iostream>
#include <locale.h>
using namespace std;
void throwing_function(int x){
if(x<0){
char *message="Eksi parametre!";
throw message;
}
}
class error{
public :
char *message;
int code;
};
void erroneous_function(int x){
if(x<0){
error e;
e.message="Eksi parameter!";
e.code=3;
throw e;
}
}
int main0602(){
setlocale(LC_ALL,"Turkish");
try{
cout<<"��lev �a�r�l�yor"<<endl;
throwing_function(-2);
cout<<"��lev �a�r�s� ba�ar�l�"<<endl;
}catch(char *message){
cout<<"��lev �a�r�s� ba�ar�s�z"<<endl;
cout<<message<<endl;
}
try{
cout<<"��lev �a�r�l�yor"<<endl;
erroneous_function(-2);
cout<<"��lev �a�r�s� ba�ar�l�"<<endl;
}catch(error e){
cout<<"��lev �a�r�s� ba�ar�s�z"<<endl;
cout<<e.code<<" : "<<e.message<<endl;
}
try{
cout<<"Yer ayr�l�yor.."<<endl;
int *a[1000];
for(int i=0;i<1000;i++){
a[i]=new int[999999999999999999];
}
cout<<"Yer ayr�ld�"<<endl;
}catch(exception &e){
cout<<"��lev �a�r�s� ba�ar�s�z"<<endl;
cout<<"Kurald���l�k: "<<e.what()<<endl;
}
return 0;
}
Dosyayı İndir