COMPTNG 10A Study Guide - Final Guide: Empty String, Uninitialized Variable, Modulo Operation

52 views3 pages
14 Sep 2017
School
Professor

Document Summary

Hardware and software: hardware = electric circuits in a plastic case, software = program(s) that tells circuits what to do. Int divided by int = int (not decimal or fraction) Include libraries = collection of code that is organized, documented, and made available to others. Const varia(cid:271)les (cid:373)ust (cid:271)e i(cid:374)itialized as it is defi(cid:374)ed (cid:894)si(cid:374)(cid:272)e it (cid:272)a(cid:374)(cid:859)t (cid:271)e (cid:272)ha(cid:374)ged later o(cid:374) Const correctness = using const to prevent const variables from being changed. If you try to print out an uninitialized variable, you can print anything (random) Floating-points types = scientific notation on computers (with binary numbers) Float: 32 bits, single-precision floating-point format, 7 digits of accuracy faster than doubles. Double: 64 bits, double-precision floating-point format, 16 digits of accuracy. Use (cid:862)+(cid:863) to (cid:272)o(cid:374)(cid:272)ate(cid:374)ate stri(cid:374)gs (cid:862)\(cid:374)(cid:863) = a line feed character same as endl returns individual characters of a string. Example: stri(cid:374)g s1 = (cid:862)joh(cid:374)(cid:863); cout << s1[0] << endl;