CS 161 Lecture Notes - Lecture 2: Semicolon, Order Of Operations

38 views3 pages

Document Summary

Cs 161 lecture 2 variable and math. Assigning values to variables: point of variable is to hold data, declare a variable. Int my_num: assignment operator = , do not call it the equal sign, use = followed by the data you want to store, my_num = 5, can declare and assign on same line. Printing variable: cout << the result is: << result << endl, alters out stream, always use cout and cin do not use c language. Predefined macros: some macros already exist for things, c limits, will go into detail in lab, use min and max. Expressions: set of operations producing a value, 12*4+6*10, use parentheses, for long equations use multiple lines to make it easier to read, pemdas. Pieces of an expression: operations: indicate operation, remainder/mod , add , subtract , multiply , divide , operands: values in the expression, evaluation: process of obtaining results from operations on operands.

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