| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Exercises - Procedures without Parameters

Page history last edited by Steve Sweeney 9 years, 2 months ago

 

For each exercise, you must also have a main program to test your procedure.

 

  1. Write a procedure called printMyName, which will print your name.  You may want to format the output to centre your name on the line. (Turing Solution)

  2. Write a procedure called printMyAddress, which will print your address.  You may want to format the output to centre your name on the line. (Turing Solution)

  3. Write a procedure called printMySignature, which will print your name and address inside a box made up of characters.  You should use the previous two procedures as part of this program.  The output might look something like: (Turing Solution)
    ********************
       Your Name      
       Your Address   
    ********************

  4. Write a procedure called checkMyName, which will keep asking for YOUR name (looping).  When you give your name, the procedure will exit and return control to the main program. (Turing Solution)

  5. Write a procedure called countDown10, which will count backwards from 10 to 0, with a 1 second delay between displaying each number on the screen. (Turing Solution)

  6. (a) Write a procedure which asks the user to enter a number (integer), and then print out the '@' character that many times on a single line.
    (b) Modify the procedure so it asks for both a number and the character to print out.

Comments (0)

You don't have permission to comment on this page.