June 22 - Pi iii. Declare variables 1. Int main C 2. Your...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
June 22 1. Variable Types a. Variable is like a box to hold information b. Computers hold a lot more things than integer numbers (x=y+4) c. Volume= 4/3*PI*radius*radius*radius i. Syntax ok (Be careful) ii. Logic ok d. 6 Variable Types i. Int - Integer ii. Float- Floating: point number 9decimals and very precise) iii. Double - decimal number iv. Char - Single alphanumeric character: A, Q, 4, # v. Boolean- true or false vi. String - Text “Hello World” e. Important Steps i. Declare your variables. Give values to the variables. Operate on the variable values output result ii. Program Goal: 1. Get radius circle of the user, and calculate area of circle, then output result Value of
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Pi iii. Declare variables 1. Int main C 2. Your code [double radius; double area; double PI= 3.14159;] 3. (; tells the compiler that this line of code is done, like a period.) 4. /n (new line) 5. Order is not important 6. Spacing is important iv. Legal variable names have letters or _ (underscore) and can have numbers but cannot start with a number. f. Is it legal? i. Int six; ok (spelling matters for commands only ) ii. Int x; ok iii. Char user_choice; ok iv. Double area2; ok v. Double _time; ok vi. Int this4u; ok vii.String 4words; x fourwords 2. Math Operations 3. Input/ Output 4. Overall Program Set Up...
View Full Document

This note was uploaded on 06/30/2010 for the course PSYCH 129B taught by Professor Kupper during the Spring '07 term at UCLA.

Page1 / 2

June 22 - Pi iii. Declare variables 1. Int main C 2. Your...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online