Codificacion Dev C++
#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;
int main( )
{
// (1) DECLARACION
double A,Q, W, V;
int opcion;
// (2) ASIGNACION
cout<<"ADICION DE DOS FUNCIONES SINUSOIDALES(CORRIENTE ALTERNA) EN FORMA FASORIAL AvQ + BvX\n\n";
cout<<"Ingrese la primera funcion \n";
cout<<"La amplitud(A): "; cin>>A;
cout<<"El angulo de desfase(Q)(rad): "; cin>>Q;
cout<<endl<<"Funcion:"<<endl;
cout<<"1.sen"<<endl;
cout<<"2.cos"<<endl;
cout<<endl<<"Elija una opcion"<<endl;
cin>>opcion;
cout<<endl;
switch(opcion)
{
// (3) PROCESO
case 1: W=Q-22/14;
V=A;
break;
case 2: W=Q;
V=A;
break;
}
// (4) RESULTADO
cout<<"La primera funcion establecida es: V=" and cout<<A and cout<<".cos(wt+" and cout<<W and cout<<")\n";
cout<<"ENTONCES LA EXPRESION POLAR O FASORIAL ES: "; cout<<V and cout<<"v" and cout<<W and cout<<"rad";
cout<<endl;
// (5) DECLARACION(2)
double B, X, Y, U;
int ALTERNATIVA;
// (6) ASIGNACION(2)
cout<<endl;
cout<<endl;
cout<<"Ingrese la segunda funcion \n";
cout<<"La amplitud(B): "; cin>>B;
cout<<"El angulo de desface(X)(rad): "; cin>>X;
cout<<endl<<"Funcion:"<<endl;
cout<<"1.sen"<<endl;
cout<<"2.cos"<<endl;
cout<<endl<<"Elija una opcion"<<endl;
cin>>ALTERNATIVA;
cout<<endl;
switch(ALTERNATIVA)
{
// (7) PROCESO(2)
case 1: U=X-22/14;
Y=B;
break;
case 2: U=X;
Y=B;
break;
}
// (8) RESULTADO(2)
cout<<"La segunda funcion establecida es: M=" and cout<<B and cout<<".cos(wt+" and cout<<U and cout<<")\n";
cout<<"ENTONCES LA EXPRESION POLAR O FASORIAL ES: "; cout<<B and cout<<"v" and cout<<U and cout<<"rad";
cout<<endl;
// (9) DECLARACION(3)
double R, M;
// (10) ASIGNACION(3)
cout<<endl;
cout<<"Se efectua la siguiente operacion: " and cout<<A and cout<<".cos(wt+" and cout<<W and cout<<") + " and cout<<B and cout<<".cos(wt+" and cout<<U and cout<<")";
cout<<endl;
cout<<" o " and cout<<V and cout<<"v" and cout<<W and cout<<"rad" and cout<<" + " and cout<<B and cout<<"v" and cout<<U and cout<<"rad";
cout<<endl;
// (11) PROCESO(3)
R=sqrt((A*cos(W)+B*cos(U))*(A*cos(W)+B*cos(U))+(A*sin(W)+B*sin(U))*(A*sin(W)+B*sin(U)));
M=atan((A*sin(W)+B*sin(U))/(A*cos(W)+B*cos(U)));
cout<<endl;
// (11) RESULTADO(3)
cout<<"La respuesta es: "; cout<<R and cout<<"v" and cout<<M and cout<<"rad";
cout<<endl;
cout<<"Donde " and cout<<R and cout<<" tiene como unidad correspondiente a la amplitud o modulo del fasor; y \n";
cout<<M and cout<<"rad correnponde al argumento del mismo.";
cout<<endl;
cout<<endl;
system("pause");
return 0;
}
No hay comentarios:
Publicar un comentario