top of page

CODIGO EN CLASES SEMANA 12

#include <iostream>
#include <math.h>
using namespace std;

int opcion=0, n=0 , c=0, SUMA=0,i=0 ,j=0;
float POTENCIA(int x, double y); //2. DECLARACIÓN
float A, L, C, fo, Q; // Agregar Q para el caudal
double PI= 3.141562;

void TABLA(), FRECUENCIA(), FRECUENCIA_L(), FRECUENCIA_L_C(); //2.

int main() {
    do {
        cout<< " M  E  N  U  \n ";
        cout<< " -------------- \n ";
        cout<< " 1.- TABLA DE MULTIPLICAR \n ";
        cout<< " 2.- FRECUENCIA DE RESONANCIA \n ";
        cout<< " 3.- Encuentre L y C utilizando parámetro variando (L) \n "; 
        cout<< " 4.- Encuentre L y C utilizando parámetros variando (L) y (C) \n "; 

        cout<< "INGRESE UNA OPCION <> 0 "; cin>>opcion;

        switch(opcion) {
            case 1:
                TABLA();
                break;
            case 2:
                FRECUENCIA();
                break;
            case 3:
                FRECUENCIA_L();
                break;
            case 4:
                FRECUENCIA_L_C(); // Cambiado a FRECUENCIA_L_C, que solicita tanto L como C
                break;
        }
    } while (opcion!=0);
}

void TABLA() {
    for(i=1; i<=12; i++) {
        cout<<"TABLA DEL "<<i<<endl;
        cout<<"----------------"<<endl;
        for(j=1; j<=12; j++)
            cout<<i<<" * "<<j<<" = "<<i*j<<endl;
        cout<<endl; // 4. resultado
    }
}

void FRECUENCIA() {
    cout<<"Ingrese la INDUCTANCIA:  "; cin>>L;
    cout<<"Ingrese la CAPACITANCIA:  "; cin>>C;
    fo = sqrt(1/(2*pow(PI,2)*L*C));
    cout<<"La frecuencia de resonancia es Fo= "<<fo<<endl<<endl;
}

void FRECUENCIA_L() {
    // fo = raiz(1/2pi²LC)
    cout<<"Ingrese la CAPACITANCIA:  "; cin>>C;
    for(L=10; L<=20; L=L+0.5) {
        fo = sqrt(1/(2*pow(PI,2)*L*C));
        cout<<"Para L = "<<L<<" La frecuencia de resonancia es Fo= "<<fo<<endl;
    }
    cout<<endl;
}

void FRECUENCIA_L_C() {
    // fo = raiz(1/2pi²LC)
    for(L=10; L<=20; L=L+0.5) {
        cout<<"Para una impedancia L = "<<L<<" los valores de la fo es:"<<endl;
        cout<<"----------------------------------------------------------- \n";
        for(C=0.5; C<=5; C=C+0.8) {
            fo = sqrt(1/(2*pow(PI,2)*L*C));
            cout<<"Para C = "<<C<<" La frecuencia de resonancia es Fo= "<<fo<<endl;
        }
        cout<<endl;
    }
}
 

bottom of page