All of the programming exercises for Chapter 4: Loops and Character Manipulation
Test whether an ASCII character is alpha-numeric
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | char |
Test whether an ASCII character is a letter
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | char |
Test whether an ASCII character is numeric
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | char |
Test whether an ASCII character is a lowercase letter
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | char |
Test whether an ASCII character is an uppercase letter
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | char |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real64), | intent(in) | :: | v_D | The voltage across the diode, in volts |
||
real(kind=real64), | intent(in) | :: | I_O | The leakage current of the diode, in amperes |
||
real(kind=real64), | intent(in) | :: | T | Temperature, in kelvins (K) |
The current flow through the diode in amperes
Convert a temperature in Fahrenheit to Kelvin
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real64), | intent(in) | :: | F |
Convert a temperature from Fahrenheit to celcius
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=real64), | intent(in) | :: | F |
Test if the following equalities are valid statements, and if they are, evaluate them
Write a Fortran program to evaluate the equation y(x) = x^2 - 3x + 2 for all values between -1 and 3, in steps of 0.1.
Write a Fortran program to calculate the factorial function. Be sure to handle the special cases of 0! and of illegal input values.
What is the difference in behavior between a cycle statement and an exit statement?
Modify program stats_2 to use the DO WHILE construct instaed of the while construct currently in the program
Examine the following DO statements and determine how many times each loop will be exectued.
Examine the following loops, determine the value of ires and the number of times each loop executes
Examine the followin while loops and determine the value of ires at the end of each of the loops.
Modify program ball from example 4-7 to read in the acceleration due to gravity at a particular location, and to calculate the maximum range of the ball for that acceleration. After modifying the program, run it with accelerations of -9.8, -9.7, and -9.6m/s2.
Modify program ball from Example 4-7 to read in the initial velocity with which the ball is thrown. After modifying the program, run it with initial velocities of 10, 20, and 20 m/sec. What effect does changin the initial velocity have on the range of the ball? What effect does it have on the best angle theta at which to throw the ball?
Write a Fortran program to evaluate the function y(x) = ln(1/1-x) for any user-specified value of x, where ln is the natural logarithm. Write the program with a while loop, so that the program repeats the calculation for each legal value of x entered into the program. When an illegal value of x is entered, terminate the program.
Write a Fortran program to convert all uppercase characters in a user-supplied character string to lowercase, without changing the uppercase and nonalphabetic characters in the string. Assume that your computer uses the ASCII collating sequence.
Write a program caps that reads in a character string, searches for all of the words within the string, and capitalizes the first letter of each word, while shifting the remainder of the word to lowercase. Assume that all nonalphabetic and nonumeric characters can mark the boundaries of a word within the character variable (periods, commas,etc.). Nonalphabetic characters should be left unchanged.
Write a computer program to calculate the current flowing through this diode for all voltages from -1.0V to +0.6 V, in 0.1 V steps. Repeat this process for the following temperatures: 75F, 100F, and 125F
Write a program that promps a user for a binary number, which will be entered as a string of 0s and 1s in a character variable. This program should be able to handle numbers whos binary representation is up to 10 bits, corresponding to values from 0 to 1023.
Convert a single character to lowercase
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(inout) | :: | char |
Convert a single character to uppercase
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(inout) | :: | char |