24 Aralık 2015 Perşembe

C++ Devre Hesabı Yapan Program

#include <iostream>
using namespace std;
double ToplamDirenc(double R1,double R2,double R3)
{ double Res;
 Res = 1 / (1/R1 + 1/R2 + 1/R3);
 return Res;
}
double AkimHesapla (double Res, double Volt)
{ double Sonuc;
 Sonuc = Volt / Res;
 return Sonuc;
}
double GucHesapla (double Akim, double Volt)
{ double Sonuc;
 Sonuc = Volt * Akim;
 return Sonuc;
}
void main()
{
 double R1,R2,R3, Volt;
 double Res, Akim,  Guc;
  
 //1. Adim  Degerleri klavyeden gir
 cout << "R1 degerini giriniz=";
 cin >> R1;
 cout << "R2 degerini giriniz=";
 cin >> R2;
 cout << "R3 degerini giriniz=";
 cin >> R3;
 cout << "Volt degerini giriniz=";
 cin >> Volt;

 //2. Adim  Esdeger direnc degerini hesapla
 Res = ToplamDirenc(R1,R2,R3);
 //3. Adim  Akim degerini hesapla
 Akim = AkimHesapla(Res,Volt);
 //4. Adim  Guc degerini hesapla
 Guc = GucHesapla(Akim,Volt);

 //5. Adim  Sonucarin yazdirilmasi
 cout << "Devrenin:\n\tToplam direnci = " << Res << endl;
 cout << "\tAkim Degeri = " << Akim << endl;
 cout << "\tGuc Degeri = " << Guc << endl;

 system("pause");
}


Hiç yorum yok :

Yorum Gönder