C++ Syntax sheet
C++ Syntax sheet CSCI 1200
Popular in Data Structures
Popular in ComputerScienence
This 2 page Class Notes was uploaded by Joshua Notetaker on Tuesday February 2, 2016. The Class Notes belongs to CSCI 1200 at Rensselaer Polytechnic Institute taught by a professor in Fall 2015. Since its upload, it has received 13 views. For similar materials see Data Structures in ComputerScienence at Rensselaer Polytechnic Institute.
Reviews for C++ Syntax sheet
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 02/02/16
Lecture 1 C++ syntax introduced (see syntax sheet): #include // (comments) int main() variable naming C-style arrays if – else statements function creation for loops while loops std::string Programming concepts Make variable names useful C++ is a compiled language, which means it runs faster, but it is pickier about it’s syntax In thinking about efficiency, pass certain variables by reference rather than by value. o To pass by reference, proceed the name with & o This means the program doesn’t have to copy everything over to the function, just the memory address, where the variable is located o This is especially useful for large variables like vectors and strings o You can then have the function change the variable, where it cannot when you pass by value Functions are useful to break up code and make it easier to read Lecture 2 C++ syntax introduced (see syntax sheet): std::vector Programming concepts vectors have several useful functions o push_back puts a new element at the end of the array o size gives you the number of elements in the array o items can be accessed by indexing vectors are useful in that they can dynamically allocate memory to change its size and capacity also have a sort function which allows you to sort vectors, either alphabetically or numerically
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'