Mizzou CMP_SC 1040 - Computer Science- After Exam 1 (4 pages)

Previewing page 1 of 4 page document View the full content.
View Full Document

Computer Science- After Exam 1



Previewing page 1 of actual document.

View the full content.
View Full Document
View Full Document

Computer Science- After Exam 1

71 views


Pages:
4
School:
University of Missouri
Course:
Cmp_Sc 1040 - Introduction to Problem Solving and Programming

Unformatted text preview:

Computer Science September 28 2011 Code for Simplified Cascade Select Case structure mimics the cascade Select Case only works for testing ONE variable in a multitude of conditions Works for either string or numerical variable All tests must be the same data type Using select case for prices Select Case age Case Is 12 Price 3 5 Case Is 18 Price 5 Case Is 65 Price 7 5 Case Else price 5 End Select More Case Examples Using Strings Select Case strVar Substring 0 1 Case S Z Statement Case 0 to 9 Statement Case Is W Statement Case Else Statement End Select Combo Box Method to force choices for users Controls type of input Example of code getting Input Dim NumberVar As Double Dim strName As String NumberVar CDbl cboInput Text strName cboEnter Text October 3 2011 Functions A mathematical function is basis of computer programming functions You supply x the function supplies f x In computer science a function is a little sub program that receives data works on data and returns a value Each function in a program has unique name I E Int Multiplylt Function is known to program because 1 Built in to VB 128 functions 2 Defined by programmer such as Multiplylt Writing Functions New Vocabulary Arguments item s sent to the function to be worked on by the function from some place within the program Parameters placeholders in the function itself that accept the arguments Function returns only ONE value Functions have Name 0 or more parameters and data type Example Function MultlT ByVal X As Integer As Integer statements here Return X X End Function Documenting a Function Three important comment lines Function goal What will it do during its duration Input What values will be given to the function form the calling program Return What value will be returned to the calling program Calling Invoking A Function Functions are called or invoked where you would expect to find a literal or expression For example dblResult functionCall arguments dblResult FindlT 23 5 98 76 dblResult FindlT 14



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Computer Science- After Exam 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Computer Science- After Exam 1 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?