LAB 1 Circuit Circulation

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Omes, Kevin O.

Microprocessor ELECS 2
LAB 1 Circuit Circulation C++

#include<stdio.h>

#include<conio.h>

#include<iostream.h>

int main(){

clrscr();

float voltage, r1,r2,r3,r4,r5,r6 ;

cout << " -------^v^--------------^v^------";

cout << "\n |\tR1\t |\t R2\t |";

cout << "\n |\t \t |\t \t |";

cout << "\n |\t \t |\t \t |";

cout << "\n--- Vt\t \t < \t \t < ";

cout << "\n -\t \t > R3\t \t > R4";

cout << "\n |\t \t |\t \t |";

cout << "\n |\t \t |\t \t |";

cout << "\n |\t \t |\t \t |";

cout << "\n -------^v^--------------^v^------";

cout << "\n \tR5\t \t R6\t";

cout << "\n\nEnter the Value of Voltage (V) : ";

cin >> voltage;

cout << "Enter the Value of Resistance R1 : ";

cin >> r1;

cout << "Enter the Value of Resistance R2 : ";

cin >> r2;

cout << "Enter the Value of Resistance R3 : ";

cin >> r3;


Omes, Kevin O.
Microprocessor ELECS 2
LAB 1 Circuit Circulation C++

cout << "Enter the Value of Resistance R4 : ";

cin >> r4;

cout << "Enter the Value of Resistance R5 : ";

cin >> r5;

cout << "Enter the Value of Resistance R6 : ";

cin >> r6;

//calculating equavalent resistance

float req = (float) ( 1 / (( 1 / (r2+r4+r6) ) + (1/r3) ) ) + r1 + r5 ;

//printing the current and voltage values

cout << "\n\tTHE COMPUTED VALUES ARE AS FOLLOWS \n";

cout << "TOTAL RESISTANCE: " << req<<" Ohms\t\t";

float current = voltage / req ;

cout << "TOTAL CURRENT: " << current <<" Amps";

//variable declaration for current and voltage

float v1, v2, v3, v4, v5, v6 ;

float i1, i2 , i3, i4, i5, i6 ;

i1 = current ;

i5 = current ;

i3 = current * ((r4 + r2 + r6) / (r4 + r2 + r6 + r3 )) ; // i3 using current division rule

i2 = i4 = i6 = current * ( (r3) / (r4 + r2 + r6 + r3 ) ) ; //i2 i4 i6 using current division rule3

v1 = i1 * r1 ; //voltage calculation at each terminal

v2 = i2 * r2 ;

v3 = i3 * r3 ;

v4 = i4 * r4 ;
Omes, Kevin O.
Microprocessor ELECS 2
LAB 1 Circuit Circulation C++

v5 = i5 * r5 ;

v6 = i6 * r6 ;

//printing the result

cout << "\nRESISTANCE(Ohms)\tVOLTAGE DROPS(V)\t\tCURRENT FLOWING (A)\n";

cout << "R1=\t"<<r1 <<"\t\t" << v1 << "\t\t\t\t" << i1 << "\n";

cout << "R2=\t"<<r2 <<"\t\t" << v2 << "\t\t\t\t" << i2 << "\n";

cout << "R3=\t"<<r3 <<"\t\t" << v3 << "\t\t\t\t" << i3 << "\n";

cout << "R4=\t"<<r4 <<"\t\t" << v4 << "\t\t\t\t" << i4 << "\n";

cout << "R5=\t"<<r5 <<"\t\t" << v5 << "\t\t\t\t" << i5 << "\n";

cout << "R6=\t"<<r6 <<"\t\t" << v6 << "\t\t\t\t" << i6 << "\n";

getch();

return 0;

}
Omes, Kevin O.
Microprocessor ELECS 2
LAB 1 Circuit Circulation C++

Screenshots:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy