0% found this document useful (0 votes)
54 views2 pages

New File - CXX

These file consists of three documents which are used to solve problems in disciplines regarding programming concepts and it lies an amazing ground for those who want to be more in programming concepts.

Uploaded by

Desyilal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views2 pages

New File - CXX

These file consists of three documents which are used to solve problems in disciplines regarding programming concepts and it lies an amazing ground for those who want to be more in programming concepts.

Uploaded by

Desyilal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Done by: Desyilal Seyoum

Id No: NasSR/0846/13
Section: 6

//Question #1
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main()
{
cout<<setw(10)<<"degree"<<setw(10)<<"sin"<<setw(10)<<"cos"<<setw(10)<<"tan"<<endl;
cout<<setprecision(4)<<setw(10)<<15<<setw(10)<<sin(15)<<setw(10)<<cos(15)<<setw(10)
<<tan(15)<<endl;
cout<<setprecision(4)<<setw(10)<<20<<setw(10)<<sin(20)<<setw(10)<<cos(20)<<setw(10)
<<tan(20)<<endl;
cout<<setprecision(4)<<setw(10)<<70<<setw(10)<<sin(70)<<setw(10)<<cos(70)<<setw(10)
<<tan(70)<<endl;

cout<<setprecision(4)<<setw(10)<<140<<setw(10)<<sin(140)<<setw(10)<<cos(140)<<setw(
10)<<tan(140)<<endl;
return 0;
}
//Question #2
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
const float e = 2.7182, k = 11.600;
float Is, Vd, Tk;
float a = pow(10, -15);
float b = pow(10, -9);
do{
cout << "Enter the saturation current in ampere from 10-?? to 10-? \n";
cin >> Is;
if (Is < a || Is > b)
cout << "Out of the range.try again...\n";
} while (Is < a || Is > b);
do{
cout << "Enter diod voltage from 0 to 1\n";
cin >> Vd;
if (Vd < 0 || Vd > 1)
cout << "Error! please try again...\n";
} while (Vd < 0 || Vd > 1);
do{
cout << "Enter the temperature from -50��C to 150��C\n ";
cin >> Tk;
if (Tk < (-50) || Tk > 150)
cout << "please insert valid temperature value...\n";
} while (Tk < (-50) || Tk > 150);
float Id = Is * (pow(e, (k * (Vd / Tk))) - 1);
cout << setprecision(4);
cout << "Diod current of the semiconductor is "<<Id;
return 0;
}
//Question #3
#include<iostream>
#include<cmath>
#include<iomanip>
#define Is pow(10,-9)
#define e 2.7182
#define k 11,600
using namespace std;
int main()
{
float Tk;
do{
cout<<"Enter the temperature from -50��C to 150��C!\n";
cin>>Tk;
if(Tk<(-50)||Tk>150)
cout<<" Invalid temperature value! please try again....\n";
} while(Tk<(-50)||Tk>150);
float v[11],Id[11],x[11],temp[11],Vd=0;
for(int i=0;i<=10;i++)
{
v[i]=Vd;
temp[i]=(k*(Vd/Tk));
x[i]=pow(e,temp[i]);
Id[i]=Is*(x[i]-1);
Vd=Vd+0.1;
}
cout<<"\tTable of current and voltage for "<<Tk<<"��C\n";
cout<<"\tVoltage(Vd)\tcurrent(Id)\n";
for(int j=0;j<=10;j++)
{
cout<<"\t\t"<<v[j]<<"\t";
cout<<Id[j]<<"\n";
}
return 0;
}

You might also like