Programming Exercises
Some users might be daunted by being asked to enter an EOF character. Modify getarray() so that a # character terminates input the first time it is entered.
Create a program that sorts float numbers in increasing order.
Modify the sort() function in Listing 13.12 so that it uses the suggestion given in the "Comments" section following the sample output; namely, that the function keep track of the index of the largest value and swap values only after the inner loop terminates.
Write and test in a loop a function that returns the number of times it has been called.
Write a program that generates a list of 100 random numbers in the range 1–10 in sorted decreasing order.
Write a program that generates 1,000 random numbers in the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access