1.1 Innetworkanalyses often T T P transformations are used, meaning that anetwork according to figure 1 is being replaced by an equivalent network according tofigure 2. file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image002.png
For these transformations the followingformulaes are valid:
file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image004.png file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image006.png file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image008.png
Write a program, that, after input of R1, R2 , and R3 computes the values of Ra , Rb and Rc .
"——————————————————————"—————————————————————"
1.2 Writea program, that, after entering of r, L and C computes for an entered frequency in Hz, the appearent resistant |Z| :
file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image010.png
"——————————————————————"—————————————————————"
1.3 Writea program, that computes the real roots x1 and x2 for the equation file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image012.png by means of the abc-formula: file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image014.png
Input a, b and c . Take care of asuitable text at input and output. Take care of an error message in
case b2-4ac is negative.
"——————————————————————"—————————————————————"
1.4 Write a program, that inputs atemperature in degrees Fahrenheit and that computes this to degrees Celsius. The formula is: file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image016.png
Choose proper values to test it anduse suitable texts.
"——————————————————————"—————————————————————"
1.5 Write a program, that computes themaximum voltage U , that can be applied to a resistor R , if that resistor canendure a dissipation P.
file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image018.png
Input R and P as positive integersand print Umax , using meaningfull texts.
"——————————————————————"—————————————————————"
2.1 Makea program to simulate the throwing of a dice. Input a number (integer); accept only numbersin the range 1 to 6.
Example, with 5 as input:
line1: XX
line2: X
line3: XX
Finally print in a loop in sequence thepatterns of line 1, 2 and 3.
The choice of the proper stringconstant for aparticular line is determined by the entered number; thus line2 will give thesame pattern on entering a 3 and/or a 5.
"——————————————————————"—————————————————————"
2.2 Abinary number can be transformed to a decimal value, by multiplying the inputevery time with 2 and (when nescessary) adding 1 to it. Example, when entering: 100101 à 37 as follows:
Input Decimal 1 à 2* 0 + 1 = 1 0 à 2* 1 + 0 = 2 0 à 2* 2 + 0 = 4 1 à 2* 4 + 1 = 9 0 à 2* 9 + 0 = 18 1 à 2* 18 + 1 = 37
Write a program, in which the binary number isinputted character after character [use the function: getche() ] and use a while() to compute the decimal value, until another character than a‘0’ or a ‘1’ is being inputted, after which the decimal number is printed onthe screen. "——————————————————————"—————————————————————"
2.3 The relation between UD and IDis given in the figure (Diode equation) file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image020.png
Write a program , that after inputting positivevalues for Uin and R computes the equilibrium, using a while{}using:
IR- ID < 1 mAmp. in the while-condition.
Hint: let, in the while{} thevoltage UD increase with steps
of 0,1 mV.
Print the thus computed voltage UDand the current ID on the screen.
"——————————————————————"—————————————————————"
2.4 Givenis the next network:
file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image022.pngThe lever of R2 can move in n steps from top to bottom.
Make aprogram that computes the voltage U1 for every position of thelever.
Print theresults in a table with “headers” : stepnumber and U1 .
Use for thetest for example n=10 , with different combinations
for U, R1 , R2 en R3 .
"——————————————————————"—————————————————————"
2.5 Writea program that asks for an integer input ‘n’ and print all integer numbers of n-digitsfor which the sum of the digits of the number, to the power of three, isequal to the number itself. Forinstance, for n=2, check all numbers in the range of 10 – 99. e.g 37 = 33+73
"——————————————————————"—————————————————————"
3.1 Thevalue of electronic components (resistors, capacitors, etc.) are indicated by a colorcoding, using3 colored rings, with the third ring being the (decimal) multiplication factor:
color value mult. factor
black 0 1 Thus yellow,violet,red means the value 4700 (4k7)
brown 1 10
red 2 100
orange 3 1k Writea program, that uses an array of strings
yellow 4 10k (forthe colors) and that prints thecolorcoding
green 5 100k (threerings), after inputting the value.
blue 6 1M
violet 7 10M
gray 8
white 9
"——————————————————————"—————————————————————"
3.2 Writea program, that after the input of a resistance-value, by means of awhile{}, checks if this valueexists inthe E12 range (10, 12, 15, 18, 22,27, 33, 39, 47, 56, 68, 82 anddecimal powers until 8,2 Mohm)
Use an array to store this E12 range.
"——————————————————————"—————————————————————"
3.3 Write aprogram to simulate the throwing of a dice. Input three binary digits p, q and r (0 or 1), which together form a binary number pqr.
Print in three statements the face of the dice,giving the value.
file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image023.pngExample:
Inputtedis 011 à the output will be:
( p=0 , q=1 , r=1)
Consider as a model for the dice the following:
| | file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image024.png |
a b Then placecrosses at a and g if p=1
c d e at b and f if (p | | q) = 1
f g at c and e if (p&&q) = 1
at d if r = 1
Hint: make a 3 x 3 array of type char. Fill this array according to the given formulas and printit.
"——————————————————————"—————————————————————"
3.4 Given isthe following resistance-network: file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image026.png
|
Make aprogram that computes the replacements resistor R1 for this network,if n and R values are being inputted.
To do so,compute:
Rn = Rns + (RBparallel to Rnp ) ,
Rn-1= R(n-1) s + (Rn parallel to R(n-1) p ) ,
:
R2 = R2 s + (R3 parallel to R2p ) , R1 = R1 s + (R2parallel to R1 p ) .
Input first the “series”-resistances (Ris)and after this the “parallel”-resistances (Rip) and put them in an
array (1 £ i £ n). Testfor Rip 1 0 . Testthe program for example with n = 3 and for different values for the
loading resistor RB .
Print the results in a table with “headers”:replacement resistance and load resistance.
"——————————————————————"—————————————————————"
3.5 ALissajou-figure can be constructed by drawing the points in a xy-plane, with for the x-coordinate the value: file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image028.png and forthe y-coordinate the value: file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image030.png with file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image032.png Make a program, that for a number ofcombinations of l and k (for ex. 1 and 1 , 1 and 2 , 1and 3 and 1 en 4 ) computes a Lissajou-figure . Store a, to whole numbers converted, coordinate-pair (i,j)in a 2-dimentional character-arrayby putting a * in the (i,j)-earray-element. Print after thecomputation the content of the array.
Choose for testing for the parameters thevalues Tmax = 400, Ymax = 26 and Xmax = 50 .
"——————————————————————"—————————————————————"
3.6 Abook is missing successive pages. The sum of these page-numbers is being entered and then the program determines which pages are missing.
One series will do!
"——————————————————————"—————————————————————"
4.1 Your program reads floatnumbers and during the reading every time the (absolute) biggest number is printed. To do so, use a function Find_max() that from two numbers returns the biggest.
Theprogram ends after entering the number 0.
"——————————————————————"—————————————————————"
4.2 Your program determines for an entered long number whether or not it isa prime number. If it is no prime number, the dividers have tobe determined and printed. To do so, use the functions Prime() , that returns wheather or not it is aprime number and Devider() , that returns a divider of the argument. "——————————————————————"—————————————————————"
4.3 Your program will, for an entered date, determine the number of dayssince a reference date (Monday , 1-1-1900) andit will give the day of the week (Mo, Th, …) for this entered date.
Usea function Nr_of_days() , returning the number of days since the referencedate.
"——————————————————————"—————————————————————"
4.4 Write a program, that during the entering of real resistance values prints the average resistance value.
Use a function Average_resistance() , tocompute the average resistance. "——————————————————————"—————————————————————"
4.5 Write a program, thatafter the entering of a real number x and an integer number n computes the value forsin_x , using factoring over n terms. Print x, sin_x, sin(x) and the n-th term.
Usethe functions Fac() and Term()according to:
sin_x= Term1 + Term2 + Term3 + … = x - x3/3! + x5/5! - x7/7! + …. [ example: Fac(3) = 1.2.3 ]
"——————————————————————"—————————————————————"
4.6 Write aprogram, that after the entering of a real number x and an integer number n computes the value for cos_x , using factoring over n terms. Print x, cos_x,cos(x) and the n-th term. Usethe function Fac() and Term() according to:
cos_x= Term1 + Term2 + Term3 + … = 1 - x2/2! + x4/4! - x6/6! + …. [ example: Fac(3) = 1.2.3 ]
"——————————————————————"—————————————————————"
4.7 Write a program, that after theentering of a real number x and a real number eps (the accuracy) computes thevalue for sin_x (until |Term(n)|<eps complies) , usingfactoring over n terms.
Print x, sin_x, sin(x) and the n-th term. Use functions Fac() andTerm() according to:
sin_x= Term1 + Term2 + Term3 + … = x - x3/3! + x5/5! - x7/7! + …. [ example: Fac(3) = 1.2.3 ]
"——————————————————————"—————————————————————"
4.8 Write a program, that after theentering of a real number x and areal number eps (the accuracy)computes thevalue for cos_x (until |Term(n)|<eps complies) , using factoring over n terms.
Print x, cos_x, cos(x) and the n-th term. Use functions Fac() and Term() according to:
cos_x= Term1 + Term2 + Term3 + … = 1 - x2/2! + x4/4! - x6/6! + …. [ example: Fac(3) = 1.2.3 ]
"——————————————————————"—————————————————————"
4.9 Write a program, that after theentering of a real number x and aninteger number n computes thevalue for exp_x , using factoring over n terms.
Print x, exp_x, ex and the n-th term. Use functions Fac() and Term() according to:
exp_x= Term1 + Term2 + Term3 + … = 1 + x/1! + x2/2! + x3/3! + …. [ example: Fac(3) = 1.2.3 ]
"——————————————————————"—————————————————————"
4.10 Avoltage source is connected to resistors according to the figure:
file://localhost/Users/china/Library/Caches/TemporaryItems/msoclip/0clip_image034.png
|
Write a program, that after the entering of Uin and Ro computes
the voltage Uout
This computation is done during the entering of R1, R2, ….Rn.
Use a function R_parallel(), that returns every time the replacements
resistance for R1, R2 ….Rn. End the program by entering a negative resistance value.
Take care of a good user inte**ce
"——————————————————————"—————————————————————"
|