0 penilaian0% menganggap dokumen ini bermanfaat (0 suara)
35 tayangan2 halaman
Csci191 LAB10: Define a new data type electro derived from float. Modify the code in such a way that variables voltage, current, power capacity and impedance become of type electro. Recompile and run the program. What are the output values?
Csci191 LAB10: Define a new data type electro derived from float. Modify the code in such a way that variables voltage, current, power capacity and impedance become of type electro. Recompile and run the program. What are the output values?
Hak Cipta:
Attribution Non-Commercial (BY-NC)
Format Tersedia
Unduh sebagai DOC, PDF, TXT atau baca online dari Scribd
Csci191 LAB10: Define a new data type electro derived from float. Modify the code in such a way that variables voltage, current, power capacity and impedance become of type electro. Recompile and run the program. What are the output values?
Hak Cipta:
Attribution Non-Commercial (BY-NC)
Format Tersedia
Unduh sebagai DOC, PDF, TXT atau baca online dari Scribd
LAB10 1. 1. Start Exercise 1 by running w10.exe. What is the output value? Impedance = 2623.1ohm
All operations in Exercise 1 are performed on float data type variables.
Define a new data type electro derived from float. Modify the code in such a way that variables voltage, current, power capacity and impedance become of type electro. Change the list of parameters and the returned value of the function getImpedance( ) to type electro
Implement a new function electro getPower( electro volt, electro
amp ) Recompile and run the program. What are the output values?
Impedance = 2623.00ohm Power = 0.00W
Let's assume that precision of all operations must be upgraded to double.
What needs to be modified in your code?
double electro;
Recompile and run the program. What are the output values?
Impedance = 2623.00ohm Power = 0.00W
2. Comment out Exercise1. Uncomment Exercise2. Recompile the
program. Any errors have been reported? – Yes / No Exercise 2 calls a function initChannels( ) to allocate one of the bands LF, MF, HF, VHF and UHF to each of 10 channels. Since an integer index is used to access array channel[i] elements, 1 stands for LF, 2 stands for MF,… 5 stands for UHF.
Run the program. What is the output?
Make the program code more readable by introducing a new enumeration type band that can only take values LF, MF, HF, VHF and UHF. You must use only enumerators for all operations on bands. Recompile and run the program. Is the same output produced? If not, check if you have specified the starting value for enumerators. Explain why the displayed values are numeric instead of LF, MF,…UHF ? 3. Comment out Exercise2. Uncomment Exercise3. Recompile the program. Any errors have been reported? – Yes / No If yes, fix the bug. What was the bug? What is the program output? 4. Comment out Exercise3. Uncomment Exercise4. Recompile the program. Any errors have been reported? – Yes / No If yes, fix the bug. What was the bug? 5. Comment out Exercise4. Uncomment Exercise5. Provide the definition of the function initialize() which, takes an array of type transistor, an array index and the array size as parameters. If array index is out of bounds the function returns false. Otherwise it initializes an element with all members equal to 0 and returns true. 6. Comment out Exercise 5. Uncomment Exercise 6. As you already know, a C function can take several arguments, but it can return no more than one value. In you program, a function getMeasure() needs to return two measured values: voltage and current. How to get around the limitation on one value returned by functions? Provide a function call, a prototype and a definition of getMeasure(), which does not takes any argument. It prompts the user to enter values of voltage and current of type float and returns these values. Display the returned values and compare them against those entered inside getMeasure(). Demonstrate your code to the tutor.
Music theory full 101-301Music theory full requirements for admission Music theory for beginner and intermediate level berklee college of music admission and requirements Music theory full requirements for admission Music theory for beginner and intermediate level berklee college of music admission and requirements Music theory full requirements for admission Music theory for beginner and intermediate level berklee college of music admission and requirements Music theory full requirements for admission Music theory for beginner and intermediate level berklee college of music admission and requirements Music theory full requirements for admission Music theory for beginner and intermediate level berklee college of music admission and requirements Music theory full requirements for admission Music theory for beginner and intermediate level berklee college of music admission and requirements Music theory full requirements for admission Music theory for beginner and intermedia