Thursday, September 25, 2014

[Delivery] Pass by value

Bài 1: Write a function which accepts an integer value as input, and returns an integer which is the cube of that input



My code + result



Bài 2: Write a function that accepts a char as input and returns true if the char is a digit from 0 to 9 or false if the character is not a digit from 0 to 9

My code + result


My code + result

Bài 3: Write a function named Smallest that takes three integer inputs and returns an integer that is the smallest of the three inputs.  Write the prototype for the Smallest function.  Write  a program that gets 3 integers from a user and displays the smallest.



My code + result



Bài 4: Write a function that, given a letter of the alphabet, returns true if the letter is a vowel (lower or uppercase) and returns false if the letter is not a vowel.




My code + result


Bài học rút ra:



  • Cấu trúc function:

type_specifier function_name (arguments) {
body of the function
return statement
}

No comments:

Post a Comment