Вы находитесь на странице: 1из 4

# #include<iostream>

## using namespace std;

void eee(double,double,double,double);
void main()
{
double m,n,o,p, a[4];
cout<<"Enter the values of
voltage,resistance,inductance,capacitance:"<<endl;
for(int i=0;i<4;i++)
cin>>a[i];
int j;
for(j=0;j<4;j++)
{if(j==0)m=a[j];
if(j==1)n=a[j];
if(j==2)o=a[j];
if(j==3)p=a[j];}
eee(m,n,o,p);
}
void eee(double v,double r,double l,double c)
{
const long pi=long (3.14);
long x,y,i;
for(i=1;i<=100;i++)
{
x=2*pi*i*l;
y=1/(2*pi*i*c);
if(x==y)break;
}
cout<<"Resonant frequency is: "<<i<<"Hz"<<endl;
double I=v/r+(x-y);
cout<<"current I: "<<I<<"mA"<<endl;
}

#include<iostream>
using namespace std;
void index(int x, int a[], int n)
{
for(int i=0; i<n; i++)
if( a[i]==x)cout<<"index of "<<x<<"is "<<i<<endl;
}
void main()
{
int a[]={22,44,33,33,99,33};
int size= sizeof(a)/sizeof(int);
index(22,a,size);
index(33,a,size);
index(99,a,size);
}

#include<iostream>
using namespace std;
void result(int, int, int);
void main()
{
int x,y,z;
cout<<"Enter the obtained number (0 to 100)"<<endl;
cout<<"Subject 1: ";cin>>x;
cout<<"Subject 2: ";cin>>y;
cout<<"Subject 3: ";cin>>z;
result(x,y,z);
}
void result(int a, int b, int c)
{
double w=0;
double g=0;
int m=a;
int n=b;
int o=c;
int sum=0;
for(int i=1;i<=3;i++)
{
if(i==1)w=m;
if(i==2)w=n;
if(i==3)w=o;
if(w<100 && w>=90)w=4.00;
else if(w<80 && w>=75)w=3.75;
else if(w<75 && w>=70)w=3.50;
g+=w;
}
sum=a+b+c;
double GPA=g/3;
cout<<"total number: "<<sum<<endl;
cout<<"total GPA: "<<GPA<<endl;
if(sum==258)cout<<" You are in the 1st position"<<endl;
else if(sum<258 && sum>240) cout<<"You are in the 2nd position"<<endl;
else cout<<"You are in the 3rd position"<<endl;
}

#include<iostream>
using namespace std;
void result(int,int,int);
void main()
{
int a[3];
int i;cout<<"Enter the obtained number(0 to 100)"<<endl;
for(i=0;i<3;i++)
{
cin>>a[i];
}
cout<<"The numbers are: "<<endl;
int x,y,z,j;
for(j=0;j<3;j++)
{
if(j==0)x=a[j];
if(j==1)y=a[j];
if(j==2)z=a[j];
}
result(x,y,z);
}
void result(int a, int b, int c)
{
double w=0;
double g=0;
int m=a;
int n=b;
int o=c;
int sum=0;
for(int i=1;i<=3;i++)
{
if(i==1)w=m;
if(i==2)w=n;
if(i==3)w=o;
if(w<100 && w>=90)w=4.00;
else if(w<80 && w>=75)w=3.75;
else if(w<75 && w>=70)w=3.50;
g+=w;
}
sum=a+b+c;
double GPA=g/3;
cout<<"total number: "<<sum<<endl;
cout<<"total GPA: "<<GPA<<endl;
if(sum==258)cout<<" You are in the 1st position"<<endl;
else if(sum<258 && sum>240) cout<<"You are in the 2nd position"<<endl;
else cout<<"You are in the 3rd position"<<endl;
}

#include<iostream>
using namespace std;
void eee(double,double,double,double);
void main()
{
double m,n,o,p;
cout<<"Input voltage: ";cin>>m;
cout<<"Resistance: ";cin>>n;
cout<<"Inductance: ";cin>>o;
cout<<"Capacitance: ";cin>>p;
eee(m,n,o,p);
}
void eee(double v,double r,double l,double c)
{
const long pi=long (3.14);
long x,y,i;
for(i=1;i<=100;i++)
{
x=2*pi*i*l;
y=1/(2*pi*i*c);
if(x==y)break;
}
cout<<"Resonant frequency is: "<<i<<"Hz"<<endl;
double I=v/r+(x-y);
cout<<"current I: "<<I<<"mA"<<endl;
}