GE 1501 Lecture 5: C++ Intro

36 views2 pages

Document Summary

Problem: determine the distance between points (1, 4) and (5, 7) Give values to the two points declaring objects. Declarations -- define variables and allocate memory. Each variable must have a type and identifier. May or may not give initial values to be stored in the momory locations. // declare and initialize objects. double x1 (1), y1(5), x2(4), y2(7), sidex, sidey, distance; Integers short (max is 32,767) int (max is 2,147,483,647) long (system dependent) Floating point float (max is 3. 4e38, precision is 6 digits) Double (max is 1. 8e308, precision is 15 digits) long double (system dependent) Symbolic constant (cost) can"t be updated ex. A sequence of characters, use double quotes, john sangster . Only math understood is: + - * / Use ; to end a statement (always) Be careful of truncation (program doesn"t round for you) Start with a letter (or an underscore) Many keywords are reserved by the software, can"t use them as variables.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents