C++ Hesap Makinesi

Konu sahibi son olarak 3308 gün önce görüldü
Kod:
#include <iostream>
#include <conio.h> //getch() fonksiyonu için...
#include <math.h> // pow ve sqrt fonksiyonları için...
#include <windows.h> // SetConsoleTitle() ve system(color ) fonksiyonları için...
using namespace std; //cin, cout, endln için...
// int
int secim,x,y,sonuc,f=1;
 //void
void AnaMenu();
void Toplama();
void Cikarma();
void Carpma();
void Bolme();
void Faktoriyel();
void Karekok();
void Kare();
void Us();
void Hakkinda();
void Cikis();
 int main(void){
 //Program Başlığı...
 SetConsoleTitle("Hesap Makinesi 2");
 //Program rengi için...
 system("color 0c");
 //Program Tanıtımı...
 cout<<"Program 6 \"bahtiyar bayramov\"\n";
 cout<<"Basit Hesap Makinesi 2 !!!\n\n";
 
 //Ana Menüye Gitmek İçin...
 AnaMenu();
 
 getch();
    return(0);
}
 //Ana Menü...
 void AnaMenu(){
 cout<<"    ------------------------\n"
  <<"   |Toplama           =>  1 |\n"
  <<"   |Cikarma           =>  2 |\n"
  <<"   |Carpma            =>  3 |\n"
  <<"   |Bolme             =>  4 |\n"
  <<"   |Faktoriyel        =>  5 |\n"
  <<"   |Karekok           =>  6 |\n"
  <<"   |Kare              =>  7 |\n"
  <<"   |Uslu Islem        =>  8 |\n"
  <<"   |Hakkinda          =>  9 |\n"
  <<"   |Cikis             =>  0 |\n"
  <<"    ------------------------ >>>>>>  ";
 cin>>secim;
 //Seçim İşlemi...
 switch(secim){
  
  case 1: 
   Toplama();
   break;
  
  case 2:
   Cikarma();
   break;
  case 3:
   Carpma();
   break;
  case 4:
   Bolme();
   break;
  case 5:
   Faktoriyel();
   break;
  case 6:
   Karekok();
   break;
  case 7:
   Kare();
   break;
  case 8:
   Us();
   break;
  case 9:
   Hakkinda();
   break;
  case 0:
   Cikis();
   break;
  default:  //Hatalı Giriş Yapıldığında...
   system ("CLS");
            cout<<"Hatali Secim Yaptiniz!!!"<<endl;
            AnaMenu();
            break;
 }
}
 //Toplama İşlemi...
 void Toplama(){
 system("color a1");
 system ("CLS");
 cout<<"Birinci sayiyi gir: \t";
 cin>>x;
 cout<<"İkinci sayiyi gir: \t";
 cin>>y;
 sonuc = x+y;
 system ("CLS");
 cout<<"\nSONUC >>>   "<<x<<" + "<<y<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Çıkarma İşlemi...
 void Cikarma(){
 system("color b0"); 
 system ("CLS");
 cout<<"Birinci sayiyi gir: \t";
 cin>>x;
 cout<<"İkinci sayiyi gir: \t";
 cin>>y;
 sonuc = x-y;
 system ("CLS");
 cout<<"\nSONUC >>>   "<<x<<" - "<<y<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Çarpma İşlemi...
 void Carpma(){
 system("color c0");
 system ("CLS");
 cout<<"Birinci sayiyi gir: \t";
 cin>>x;
 cout<<"İkinci sayiyi gir: \t";
 cin>>y;
 sonuc = x*y;
 system ("CLS");
 cout<<"\nSONUC >>>   "<<x<<" * "<<y<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Bölme İşlemi...
 void Bolme(){
 system("color d0");
 system ("CLS");
 cout<<"Birinci sayiyi gir: \t";
 cin>>x;
 cout<<"İkinci sayiyi gir: \t";
 cin>>y;
 sonuc = x/y;
 system ("CLS");
 cout<<"\nSONUC >>>   "<<x<<" / "<<y<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Faktoriyelini Alma İşlemi...
 void Faktoriyel(){
 system("color e0");
 system ("CLS");
 int a,b,f=1;
  cout<<"Faktoriyeli icin bir sayi gir: \t";
     cin>>a;
       // Öncelikle b yi girdiğimiz sayıya eşitliyoruz sonra b nin 1 den küçük eşit olmasını istiyoruz ve sayiyi 1 azaltıyoruz...
       for(b=a;b>=1;b--){
             f=f*b;
             }
 system ("CLS");
 cout<<"\nSONUC >>>   "<<a<<"!"<<" = "<<f<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Karekökünü Alma İşlemi...
 void Karekok(){
 system("color f0");
 system ("CLS");
 cout<<"Karekoku icin bir sayi gir: \t";
 cin>>x;
 sonuc = sqrt(x);
 system ("CLS");
 cout<<"\nSONUC >>>   "<<" Karekok "<<x<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Karesini Alma İşlemi...
 void Kare(){
 system("color 50");
 system ("CLS");
 cout<<"Karesi icin bir sayi gir: \t";
 cin>>x;
 sonuc = x*x;
 system ("CLS");
 cout<<"\nSONUC >>>   "<<x<<" * "<<x<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Üssünü Alma İşlemi...
 void Us(){
 system("color 20");
 system ("CLS");
 cout<<"Bir sayi gir: \t";
 cin>>x;
 cout<<"Bu sayinin ussunu gir: \t";
 cin>>y;
 sonuc = pow(x,y);
 system ("CLS");
 cout<<"\nSONUC >>>   "<<x<<" ussu "<<y<<" = "<<sonuc<<endl<<endl<<endl;
 cout<<"--------------------------------------------------------------------------------\n";
 
 AnaMenu();
}
 //Program Hakkında...
 void Hakkinda(){
 system("color 30");
 system ("CLS");
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"||||||||||||||||           BU BIR PROGRAMDIR :) :) :)           ||||||||||||||||\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
 AnaMenu();
}
//Çıkış işlemi...
void Cikis(){
 system("color 40");
system ("CLS"); 
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"|||||||||||||||| Beni kullandigin icin TESEKKUR EDERIM :) :) :) ||||||||||||||||\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
cout<<"--------------------------------------------------------------------------------\n";
}
 
/*
 
   Tarih: 24.09.2013
   Saat: 21:59
   Hazırlayan: Bahtiyar Bayramov
   Satır sayısı: 270
   
*/
 
Geri