C++ Circuit Project
C++ Circuit Project
College of Engineering
Department of Electrical and Computer
Engineering
CIRCUITS-I
C++ PROJECT -1
Abdullah Alanezi
Dr. Marpaka
DUE DATE
04/15/2015
TABLE OF CONTENTS
Table of contents
I.
Problem Statement .
II.
III.
V.
VI.
Output
VII.
Conclusion.
VIII. reference .
I.
Problem Statement:
Use C++ to determine problem 3.19, 3.24 and 3.25
II.
a. Overview:
The purpose of this project was to use a computer program called C++ so that it
will determine the voltage and the current with a C++ language (coding).
b. Assumptions:
N/A
c. Variable List:
N/A
d. Limitations
There is one point where C++ won't help you, but you'll have to use your
compiler's implementation to integrate with assembly code. Basically, the only
limitation is what would make your code non-portable to other platforms, namely
writing assembly statements.
The second limitation is that code compiled for a certain architecture will be hard
to be used on other platforms... but if we think about the processor as a virtual
machine... we might even disconsider lack of bytecode as a shortcoming.
III.
way of storing different values in variables of potentially different types under the
same name.
Making it a modular program, its way too easy to modify it because of its design.
b. Algorithm:
N/A
c. Flow Chart:
N/A
IV.
V.
Input data:
VI.
output
Thisprogramcalcultedthenodevoltagesofacircuithaveforenon //
referencenodes\n
withtwoindependentcurrentsourcesandoneindependentvoltage //
.source
<include<iostream#
<include<cmath#
<include<iomanip#
;usingnamespacestd
()intmain
}
.Declareandinitailizetheobjects//
;doubledomain,domainV1,domainV2,V1,V2
cout<<"NOTETHATResistorsR1,R2,andcurrentsourceI1
;connectedtonode1."<<endl
cout<<"ResistorsR2,R3,andcurrentsourceI2connectedtonode
;2.\n"<<endl
.Calculatethedomainofthemetrix//
;domain=(8*13)((7)*(2))
;domainV1=36*(13)((2)*(504))
;domainV2=8*(504)(36*(7))
;cout<<"Deltais\nD="<<domain<<endl
;cout<<"Delta1is\nD1="<<domainV1<<endl
;cout<<"Delta2is\nD2="<<domainV2<<endl
if(domain!=0)
}
.Calculatethenodevoltageofthecircuit //
;V1=domainV1/domain
;V2=domainV2/domain
;cout<<"Thevoltageatnode1is\nV1="<<V1<<endl
;cout<<"Thevoltageatnode2is\nV2="<<V2<<endl
{
else
}
cout<<"TheDeterminantiszero\nD=0\nCramer'srulecannot
;usedforthiscircuit."<<endl
{
;return0
Conclusion:
In conclusion, this program helped to understand how currents and voltages are
worked together in the C++ form. Moreover, learning about structures and how it
works by values in variables and storage. The program result was matched as hand
calculation. I really enjoyed this program and as a future it will always help for my other
classes.
Reference:
Alexander, Charles K. and Matthew Sadiku, Fundamentals of Electric
Circuits, 5th Edition, McGraw Hill, Boston, MA, 2013.
PSPICE. Upenn.edu. University of Pennsylvania. n.d. Web. 5 Dec. 2012.