From dfe06c0de4d07ff0dc770e9a0819f94b1e660ae9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 1 Jun 2022 12:15:18 -0700 Subject: feat: initial commit --- .bazelrc | 13 + .gitignore | 11 + CMakeLists.txt | 8 + LICENSE | 674 ++ WORKSPACE | 1 + cs162/BUILD | 14 + cs162/CMakeLists.txt | 10 + cs162/wk1/BUILD | 33 + cs162/wk1/CMakeLists.txt | 3 + cs162/wk1/quickstop/CMakeLists.txt | 4 + cs162/wk1/quickstop/quickstop.cc | 57 + cs162/wk1/random2dArrays/CMakeLists.txt | 4 + cs162/wk1/random2dArrays/random2dArrays.cc | 205 + cs162/wk1/randoms/CMakeLists.txt | 4 + cs162/wk1/randoms/randoms.cc | 71 + cs162/wk10/BUILD | 25 + cs162/wk10/CMakeLists.txt | 2 + cs162/wk10/dynamicArray/CMakeLists.txt | 7 + cs162/wk10/dynamicArray/dynamicArray.cc | 65 + cs162/wk10/pointersOnly/CMakeLists.txt | 7 + cs162/wk10/pointersOnly/pointersOnly.cc | 40 + cs162/wk2/BUILD | 26 + cs162/wk2/CMakeLists.txt | 2 + cs162/wk2/dictionaryRead/CMakeLists.txt | 4 + cs162/wk2/dictionaryRead/dictionaryRead.cc | 31 + cs162/wk2/friendsFile/CMakeLists.txt | 4 + cs162/wk2/friendsFile/friendsFile.cc | 57 + cs162/wk3/BUILD | 15 + cs162/wk3/CMakeLists.txt | 1 + cs162/wk3/musicStruct/CMakeLists.txt | 4 + cs162/wk3/musicStruct/musicStruct.cc | 168 + cs162/wk4/BUILD | 15 + cs162/wk4/CMakeLists.txt | 1 + cs162/wk4/dateClass/CMakeLists.txt | 4 + cs162/wk4/dateClass/date.cc | 79 + cs162/wk4/dateClass/date.hh | 35 + cs162/wk4/dateClass/testDate.cc | 58 + cs162/wk5/BUILD | 24 + cs162/wk5/CMakeLists.txt | 2 + cs162/wk5/country/CMakeLists.txt | 4 + cs162/wk5/country/country.cc | 22 + cs162/wk5/country/country.hh | 54 + cs162/wk5/country/testCountry.cc | 103 + cs162/wk5/gradesHelpers/CMakeLists.txt | 4 + cs162/wk5/gradesHelpers/grades.cc | 64 + cs162/wk5/gradesHelpers/grades.hh | 41 + cs162/wk5/gradesHelpers/testGrades.cc | 53 + cs162/wk6/BUILD | 24 + cs162/wk6/CMakeLists.txt | 2 + cs162/wk6/friends/CMakeLists.txt | 4 + cs162/wk6/friends/bankAccount.cc | 43 + cs162/wk6/friends/bankAccount.hh | 42 + cs162/wk6/friends/testBankAccount.cc | 39 + cs162/wk6/overload/CMakeLists.txt | 4 + cs162/wk6/overload/shape.cc | 74 + cs162/wk6/overload/shape.hh | 45 + cs162/wk6/overload/testShape.cc | 76 + cs162/wk7/BUILD | 15 + cs162/wk7/CMakeLists.txt | 1 + cs162/wk7/course/CMakeLists.txt | 4 + cs162/wk7/course/course.cc | 85 + cs162/wk7/course/course.hh | 52 + cs162/wk7/course/student.cc | 21 + cs162/wk7/course/student.hh | 30 + cs162/wk7/course/testCourse.cc | 104 + cs162/wk8/BUILD | 15 + cs162/wk8/CMakeLists.txt | 1 + cs162/wk8/inherit/CMakeLists.txt | 10 + cs162/wk8/inherit/employee.cc | 25 + cs162/wk8/inherit/employee.hh | 49 + cs162/wk8/inherit/hourlyEmployee.cc | 7 + cs162/wk8/inherit/hourlyEmployee.hh | 31 + cs162/wk8/inherit/salesperson.cc | 11 + cs162/wk8/inherit/salesperson.hh | 35 + cs162/wk8/inherit/testEmployeeADTs.cc | 214 + cs162/wk9/BUILD | 15 + cs162/wk9/CMakeLists.txt | 1 + cs162/wk9/vectors/CMakeLists.txt | 7 + cs162/wk9/vectors/vectors.cc | 172 + data/BUILD | 1 + data/dataFile.txt | 1 + data/nums.txt | 9 + data/words.txt | 10000 +++++++++++++++++++++++++++ scripts/format | 3 + 84 files changed, 13405 insertions(+) create mode 100644 .bazelrc create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 LICENSE create mode 100644 WORKSPACE create mode 100644 cs162/BUILD create mode 100644 cs162/CMakeLists.txt create mode 100644 cs162/wk1/BUILD create mode 100644 cs162/wk1/CMakeLists.txt create mode 100644 cs162/wk1/quickstop/CMakeLists.txt create mode 100644 cs162/wk1/quickstop/quickstop.cc create mode 100644 cs162/wk1/random2dArrays/CMakeLists.txt create mode 100644 cs162/wk1/random2dArrays/random2dArrays.cc create mode 100644 cs162/wk1/randoms/CMakeLists.txt create mode 100644 cs162/wk1/randoms/randoms.cc create mode 100644 cs162/wk10/BUILD create mode 100644 cs162/wk10/CMakeLists.txt create mode 100644 cs162/wk10/dynamicArray/CMakeLists.txt create mode 100644 cs162/wk10/dynamicArray/dynamicArray.cc create mode 100644 cs162/wk10/pointersOnly/CMakeLists.txt create mode 100644 cs162/wk10/pointersOnly/pointersOnly.cc create mode 100644 cs162/wk2/BUILD create mode 100644 cs162/wk2/CMakeLists.txt create mode 100644 cs162/wk2/dictionaryRead/CMakeLists.txt create mode 100644 cs162/wk2/dictionaryRead/dictionaryRead.cc create mode 100644 cs162/wk2/friendsFile/CMakeLists.txt create mode 100644 cs162/wk2/friendsFile/friendsFile.cc create mode 100644 cs162/wk3/BUILD create mode 100644 cs162/wk3/CMakeLists.txt create mode 100644 cs162/wk3/musicStruct/CMakeLists.txt create mode 100644 cs162/wk3/musicStruct/musicStruct.cc create mode 100644 cs162/wk4/BUILD create mode 100644 cs162/wk4/CMakeLists.txt create mode 100644 cs162/wk4/dateClass/CMakeLists.txt create mode 100644 cs162/wk4/dateClass/date.cc create mode 100644 cs162/wk4/dateClass/date.hh create mode 100644 cs162/wk4/dateClass/testDate.cc create mode 100644 cs162/wk5/BUILD create mode 100644 cs162/wk5/CMakeLists.txt create mode 100644 cs162/wk5/country/CMakeLists.txt create mode 100644 cs162/wk5/country/country.cc create mode 100644 cs162/wk5/country/country.hh create mode 100644 cs162/wk5/country/testCountry.cc create mode 100644 cs162/wk5/gradesHelpers/CMakeLists.txt create mode 100644 cs162/wk5/gradesHelpers/grades.cc create mode 100644 cs162/wk5/gradesHelpers/grades.hh create mode 100644 cs162/wk5/gradesHelpers/testGrades.cc create mode 100644 cs162/wk6/BUILD create mode 100644 cs162/wk6/CMakeLists.txt create mode 100644 cs162/wk6/friends/CMakeLists.txt create mode 100644 cs162/wk6/friends/bankAccount.cc create mode 100644 cs162/wk6/friends/bankAccount.hh create mode 100644 cs162/wk6/friends/testBankAccount.cc create mode 100644 cs162/wk6/overload/CMakeLists.txt create mode 100644 cs162/wk6/overload/shape.cc create mode 100644 cs162/wk6/overload/shape.hh create mode 100644 cs162/wk6/overload/testShape.cc create mode 100644 cs162/wk7/BUILD create mode 100644 cs162/wk7/CMakeLists.txt create mode 100644 cs162/wk7/course/CMakeLists.txt create mode 100644 cs162/wk7/course/course.cc create mode 100644 cs162/wk7/course/course.hh create mode 100644 cs162/wk7/course/student.cc create mode 100644 cs162/wk7/course/student.hh create mode 100644 cs162/wk7/course/testCourse.cc create mode 100644 cs162/wk8/BUILD create mode 100644 cs162/wk8/CMakeLists.txt create mode 100644 cs162/wk8/inherit/CMakeLists.txt create mode 100644 cs162/wk8/inherit/employee.cc create mode 100644 cs162/wk8/inherit/employee.hh create mode 100644 cs162/wk8/inherit/hourlyEmployee.cc create mode 100644 cs162/wk8/inherit/hourlyEmployee.hh create mode 100644 cs162/wk8/inherit/salesperson.cc create mode 100644 cs162/wk8/inherit/salesperson.hh create mode 100644 cs162/wk8/inherit/testEmployeeADTs.cc create mode 100644 cs162/wk9/BUILD create mode 100644 cs162/wk9/CMakeLists.txt create mode 100644 cs162/wk9/vectors/CMakeLists.txt create mode 100644 cs162/wk9/vectors/vectors.cc create mode 100644 data/BUILD create mode 100644 data/dataFile.txt create mode 100644 data/nums.txt create mode 100644 data/words.txt create mode 100644 scripts/format diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..ff75819 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,13 @@ +build -c fastbuild --enable_platform_specific_config +build --repo_env=CC=clang++ + +build:linux --cxxopt="-std=c++20" --cxxopt="-Weverything" --cxxopt="-Wno-c++98-compat" + +build:macos --cxxopt="-std=c++20" --cxxopt="-Weverything" --cxxopt="-Wno-c++98-compat" + +# https://blog.bazel.build/2018/01/19/config-parsing-order.html +build:opt --config=linux --copt="-03" +build:opt --config=macos --copt="-03" +build:opt --config=windows --copt="/GL + +build:windows --cxxopt="/std:c++latest" --copt="/W4" --copt="/WX" # --copt="/Wall" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..858068a --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# Bazel +bazel-* + +# CMake +cmake-* + +# CLion +.idea + +# Visual Studio Code +.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..92bf824 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.21) +project(cs162) + +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_subdirectory(cs162) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..391fd38 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1 @@ +workspace(name = "cs162") diff --git a/cs162/BUILD b/cs162/BUILD new file mode 100644 index 0000000..10ccc2e --- /dev/null +++ b/cs162/BUILD @@ -0,0 +1,14 @@ +filegroup( + name = "build_all", + srcs = [ + "//cs162/wk1:build_all", + "//cs162/wk2:build_all", + "//cs162/wk3:build_all", + "//cs162/wk4:build_all", + "//cs162/wk5:build_all", + "//cs162/wk6:build_all", + "//cs162/wk7:build_all", + "//cs162/wk8:build_all", + "//cs162/wk9:build_all", + ], +) diff --git a/cs162/CMakeLists.txt b/cs162/CMakeLists.txt new file mode 100644 index 0000000..e5cdfca --- /dev/null +++ b/cs162/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(wk1) +add_subdirectory(wk2) +add_subdirectory(wk3) +add_subdirectory(wk4) +add_subdirectory(wk5) +add_subdirectory(wk6) +add_subdirectory(wk7) +add_subdirectory(wk8) +add_subdirectory(wk9) +add_subdirectory(wk10) diff --git a/cs162/wk1/BUILD b/cs162/wk1/BUILD new file mode 100644 index 0000000..0e5dde9 --- /dev/null +++ b/cs162/wk1/BUILD @@ -0,0 +1,33 @@ +cc_binary( + name = "quickstop", + srcs = glob([ + "quickstop/**/*.cc", + "quickstop/**/*.hh", + ]), +) + +cc_binary( + name = "random2dArrays", + srcs = glob([ + "random2dArrays/**/*.cc", + "random2dArrays/**/*.hh", + ]), +) + +cc_binary( + name = "randoms", + srcs = glob([ + "randoms/**/*.cc", + "randoms/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "quickstop", + "random2dArrays", + "randoms", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk1/CMakeLists.txt b/cs162/wk1/CMakeLists.txt new file mode 100644 index 0000000..b253e2d --- /dev/null +++ b/cs162/wk1/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(randoms) +add_subdirectory(quickstop) +add_subdirectory(random2dArrays) diff --git a/cs162/wk1/quickstop/CMakeLists.txt b/cs162/wk1/quickstop/CMakeLists.txt new file mode 100644 index 0000000..59d03bd --- /dev/null +++ b/cs162/wk1/quickstop/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk1_quickstop) + +add_executable(wk1_quickstop quickstop.cc) diff --git a/cs162/wk1/quickstop/quickstop.cc b/cs162/wk1/quickstop/quickstop.cc new file mode 100644 index 0000000..208ac5c --- /dev/null +++ b/cs162/wk1/quickstop/quickstop.cc @@ -0,0 +1,57 @@ +#include + +// Print instructions +void instructions(); +// Get and assign the input +void getInput(double &, int &); +// Calculate the adjusted price +double price(double, int); +// Output the adjusted price +void giveOutput(double, int, double); + +int main() { + // Declare variables + double wholesalePrice; + int shelfDays; + double adjustedPrice; + + instructions(); + getInput(wholesalePrice, shelfDays); + adjustedPrice = price(wholesalePrice, shelfDays); + giveOutput(wholesalePrice, shelfDays, adjustedPrice); + + return 0; +} + +void instructions() { + // Output instructions + std::cout << "Enter the wholesale price and the number of days the item is" + "expected to be on shelf, get adjusted price.\n" + << std::endl; +} + +void getInput(double &cost, int &turnover) { + // Get and assign input + std::cout << "Wholesale price: "; + std::cin >> cost; + std::cout << "Number of days item is expected to be on a shelf: "; + std::cin >> turnover; +} + +double price(double cost, int turnover) { + // Compare `turnover` to get adjusted price + if (turnover <= 7) { + return cost + (5.0f / cost); + } else if (turnover > 7) { + return cost + (10.0f / cost); + } + + return 0.0f; +} + +void giveOutput(double cost, int turnover, double price) { + // Output adjusted price + std::cout << "\nIf an item costing $" << cost + << " is expected to be on a shelf for " << turnover + << " days, the item will cost $" << price << std::endl; +} diff --git a/cs162/wk1/random2dArrays/CMakeLists.txt b/cs162/wk1/random2dArrays/CMakeLists.txt new file mode 100644 index 0000000..8bf860a --- /dev/null +++ b/cs162/wk1/random2dArrays/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk1_random2dArrays) + +add_executable(wk1_random2dArrays random2dArrays.cc) diff --git a/cs162/wk1/random2dArrays/random2dArrays.cc b/cs162/wk1/random2dArrays/random2dArrays.cc new file mode 100644 index 0000000..db2a8c9 --- /dev/null +++ b/cs162/wk1/random2dArrays/random2dArrays.cc @@ -0,0 +1,205 @@ +#include +#include +#include + +// Declare a helper macro for obtaining random numbers +#define realRand() distribution(mersenneTwister) + +// Prints an array +void printArrayOfSize(int[], int); +// Prints a two-dimensional array (uses `printArrayOfSize` internally) +void printTwoDimensionalArray(int[4][5]); +// Adds two, two-dimensional arrays +void addTwoDimensionalArrayCells(int[4][5], int[4][5], int[4][5]); +// Adds two, two-dimensional arrays' rows +void addTwoDimensionalArrayRows(int[4][5], int[4]); +// Adds two, two-dimensional arrays' columns +void addTwoDimensionalArrayColumns(int[4][5], int[5]); +int addTwoDimensionalArrays(int[4][5], int[4][5]); + +int main() { + // Declare variables + int arrayOne[4][5]; + int arrayTwo[4][5]; + int userChoice; + // Decided to use C++11 random for sound non-predictable random numbers + std::random_device randomDevice; + std::mt19937_64 mersenneTwister(randomDevice()); + std::uniform_real_distribution distribution(10.0, 99.0); + + // Iterate over `arrayOne` and `arrayTwo` + for (int i = 0; i < 4; ++i) { + // Iterate over `arrayOne` and `arrayTwo`'s rows + for (int j = 0; j < 5; ++j) { + // Generate and assign a random `int` + arrayOne[i][j] = + static_cast(realRand()); // arrayOne[i][j] = realRand(); + arrayTwo[i][j] = + static_cast(realRand()); // arrayTwo[i][j] = realRand(); + } + } + + // Output information + std::cout << "Choose what to do with two randomly generated 2D arrays\n" + "1. Display both 2D arrays\n" + "2. Add both 2D arrays\n" + "3. Add rows of both 2D arrays\n" + "4. Add columns of both 2D arrays\n" + "5. Add all values of both arrays\n" + << std::endl + << "Your choice: "; + // Get user's choice + std::cin >> userChoice; + + // Run correct branch per user's choice + switch (userChoice) { + // Output arrays + case 1: { + std::cout << "\nArray one:\n"; + printTwoDimensionalArray(arrayOne); + + std::cout << "Array two:\n"; + printTwoDimensionalArray(arrayTwo); + } break; + + // Add and output arrays + case 2: { + int addArray[4][5]; + + addTwoDimensionalArrayCells(arrayOne, arrayTwo, addArray); + + std::cout << "\nArray one:\n"; + printTwoDimensionalArray(arrayOne); + + std::cout << "Array two:\n"; + printTwoDimensionalArray(arrayTwo); + + std::cout << '\n'; + + std::cout << "Added arrays:\n"; + printTwoDimensionalArray(addArray); + } break; + + // Add and output arrays' rows + case 3: { + int arrayOneRowsSums[4] = {0}; + int arrayTwoRowsSums[4] = {0}; + + std::cout << "\nArray one:\n"; + printTwoDimensionalArray(arrayOne); + + std::cout << "Array two:\n"; + printTwoDimensionalArray(arrayTwo); + + std::cout << '\n'; + + addTwoDimensionalArrayRows(arrayOne, arrayOneRowsSums); + addTwoDimensionalArrayRows(arrayTwo, arrayTwoRowsSums); + + std::cout << "Array one row sums:\n"; + printArrayOfSize(arrayOneRowsSums, 4); + + std::cout << '\n'; + + std::cout << "Array two row sums:\n"; + printArrayOfSize(arrayTwoRowsSums, 4); + } break; + + // Add and output arrays' columns + case 4: { + int arrayOneColumnsSums[5] = {0}; + int arrayTwoColumnsSums[5] = {0}; + + std::cout << "\nArray one:\n"; + printTwoDimensionalArray(arrayOne); + + std::cout << "Array two:\n"; + printTwoDimensionalArray(arrayTwo); + + std::cout << '\n'; + + addTwoDimensionalArrayColumns(arrayOne, arrayOneColumnsSums); + addTwoDimensionalArrayColumns(arrayTwo, arrayTwoColumnsSums); + + std::cout << "Array one row columns:\n"; + printArrayOfSize(arrayOneColumnsSums, 5); + + std::cout << '\n'; + + std::cout << "Array two row columns:\n"; + printArrayOfSize(arrayTwoColumnsSums, 5); + } break; + + case 5: { + std::cout << "\nAll cells of array one plus array two: " + << addTwoDimensionalArrays(arrayOne, arrayTwo) << '\n'; + } break; + + default: { + std::cout << "That is not a valid choice.\n"; + } break; + } + + return 0; +} + +void printArrayOfSize(int array[4], int size) { + // Iterate over `array` + for (int i = 0; i < size; ++i) { + std::cout << std::right << std::setw(3) << " " << array[i]; + } +} + +void printTwoDimensionalArray(int array[4][5]) { + // Iterate over `array` + for (int i = 0; i < 4; ++i) { + printArrayOfSize(array[i], 5); + + std::cout << '\n'; + } +} + +void addTwoDimensionalArrayCells(int arrayOne[4][5], int arrayTwo[4][5], + int addArray[4][5]) { + // Iterate over arrays + for (int i = 0; i < 4; ++i) { + // Iterate over arrays' rows + for (int j = 0; j < 5; ++j) { + addArray[i][j] = arrayOne[i][j] + arrayTwo[i][j]; + } + } +} + +void addTwoDimensionalArrayRows(int array[4][5], int sum[4]) { + // Iterate over arrays + for (int i = 0; i < 4; ++i) { + // Iterate over arrays' rows + for (int j = 0; j < 5; ++j) { + sum[i] += array[i][j]; + } + } +} + +void addTwoDimensionalArrayColumns(int array[4][5], int sum[5]) { + // Iterate over arrays + for (int i = 0; i < 4; ++i) { + // Iterate over arrays' rows + for (int j = 0; j < 5; ++j) { + sum[j] = array[0][j] + array[1][j] + array[2][j] + array[3][j]; + } + } +} + +int addTwoDimensionalArrays(int arrayOne[4][5], int arrayTwo[4][5]) { + int sum = 0; + + // Iterate over arrays + for (int i = 0; i < 4; ++i) { + // Iterate over arrays' rows + for (int j = 0; j < 5; ++j) { + sum += arrayOne[i][j] + arrayTwo[i][j]; + } + } + + return sum; +} diff --git a/cs162/wk1/randoms/CMakeLists.txt b/cs162/wk1/randoms/CMakeLists.txt new file mode 100644 index 0000000..85226b3 --- /dev/null +++ b/cs162/wk1/randoms/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk1_randoms) + +add_executable(wk1_randoms randoms.cc) diff --git a/cs162/wk1/randoms/randoms.cc b/cs162/wk1/randoms/randoms.cc new file mode 100644 index 0000000..ec7d11c --- /dev/null +++ b/cs162/wk1/randoms/randoms.cc @@ -0,0 +1,71 @@ +#include + +// Check if there are any duplicates within the array given the array, number +// to check against, and a reference to a variable which will be used to keep +// track if the duplicates within the array. +void checkArrayForDupes(const int[20], int, int &); +// Print the entire array +void printArray(const int[20]); +// Given a variable which may or may not be zero, a reference to a variable +// which will be assigned to, and the value to assign to the reference; check +// if the value is zero and assign if the value is zero. +bool assignIfZero(int &, int &, int); + +int main() { + int randomNumbers[20]; + + // Seed `rand` + srand(static_cast(time(nullptr))); // srand(time(nullptr)); + + // Iterate over `random_numbers` + for (int &randomNumber : randomNumbers) { + // Iterate endlessly until a unique number is found + for (;;) { + // Generate a random `int` + int randomInt = rand() % (20 + 1 - 1) + 1; + // Keep track of how many times the random number occurs within the + // array + int duplicates = 0; + + // Check if the random number already has occurred within the array + checkArrayForDupes(randomNumbers, randomInt, duplicates); + + // If the random number has not occurred yet, assign it and break out + // of the loop + if (assignIfZero(duplicates, randomNumber, randomInt)) { + break; + } + } + } + + // Print out array values + printArray(randomNumbers); + + return 0; +} + +void checkArrayForDupes(const int numbers[20], int number, int &duplicates) { + for (int i = 0; i < 20; ++i) { + if (numbers[i] == number) { + duplicates += 1; + } + } +} + +void printArray(const int numbers[20]) { + for (int i = 0; i < 20; ++i) { + std::cout << numbers[i] << std::endl; + } +} + +bool assignIfZero(int &compare, int &assign, int value) { + if (compare == 0) { + // Assign is a part of the array, so this function makes changes to a + // value in the array. + assign = value; + + return true; + } + + return false; +} diff --git a/cs162/wk10/BUILD b/cs162/wk10/BUILD new file mode 100644 index 0000000..f15d0eb --- /dev/null +++ b/cs162/wk10/BUILD @@ -0,0 +1,25 @@ +cc_binary( + name = "pointersOnly", + srcs = glob([ + "pointersOnly/**/*.cc", + "pointersOnly/**/*.hh", + ]), +) + +cc_binary( + name = "dynamicArray", + srcs = glob([ + "dynamicArray/**/*.cc", + "dynamicArray/**/*.hh", + ]), + data = ["//data:dataFile.txt"], +) + +filegroup( + name = "build_all", + srcs = [ + "pointersOnly", + "dynamicArray", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk10/CMakeLists.txt b/cs162/wk10/CMakeLists.txt new file mode 100644 index 0000000..6ba4ef3 --- /dev/null +++ b/cs162/wk10/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(pointersOnly) +add_subdirectory(dynamicArray) diff --git a/cs162/wk10/dynamicArray/CMakeLists.txt b/cs162/wk10/dynamicArray/CMakeLists.txt new file mode 100644 index 0000000..d4c4a57 --- /dev/null +++ b/cs162/wk10/dynamicArray/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.21) +project(wk10_dynamicArray) + +add_executable( + wk10_dynamicArray + dynamicArray.cc +) \ No newline at end of file diff --git a/cs162/wk10/dynamicArray/dynamicArray.cc b/cs162/wk10/dynamicArray/dynamicArray.cc new file mode 100644 index 0000000..5fcba9a --- /dev/null +++ b/cs162/wk10/dynamicArray/dynamicArray.cc @@ -0,0 +1,65 @@ +#include +#include +#include +#include + +int main() { + std::size_t data_file_size = 0; + std::ifstream data_file("data/dataFile.txt"); + std::string data_item; + int lowest = std::numeric_limits::max(); + int highest = std::numeric_limits::lowest(); + + // Make sure the file is open + if (!data_file.is_open()) { + std::cout << "data file is not open" << std::endl; + + return 0; + } + + // Count how many numbers there are in the data file + while (data_file >> data_item) { + data_file_size += 1; + } + + // Seek back the beginning the of the file + data_file.clear(); + data_file.seekg(0, std::ios::beg); + + // auto data = std::make_unique(data_file_size); + // Set up a dynamic array to hold the exact number of numbers in the data file + int *data = new int[data_file_size]; + + // Read the values from the data file into the array + for (std::size_t i = 0; i < data_file_size; ++i) { + data_file >> data[i]; + } + + // Sort the array using bubble sort + for (std::size_t i = 0; i < data_file_size - 1; ++i) { + for (std::size_t j = 0; j < data_file_size - 1; ++j) { + if (data[j] > data[j + 1]) { + std::swap(data[j], data[j + 1]); + } + } + } + + // Find the lowest and highest numbers in the array + for (std::size_t i = 0; i < data_file_size; ++i) { + if (data[i] < lowest) { + lowest = data[i]; + } + + if (data[i] > highest) { + highest = data[i]; + } + } + + // Output the lowest and highest numbers in the array + std::cout << "lowest: " << lowest << "\nhighest: " << highest << std::endl; + + // Free the array + delete[] data; + + return 0; +} diff --git a/cs162/wk10/pointersOnly/CMakeLists.txt b/cs162/wk10/pointersOnly/CMakeLists.txt new file mode 100644 index 0000000..7aaa73e --- /dev/null +++ b/cs162/wk10/pointersOnly/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.21) +project(wk10_pointersOnly) + +add_executable( + wk10_pointersOnly + pointersOnly.cc +) \ No newline at end of file diff --git a/cs162/wk10/pointersOnly/pointersOnly.cc b/cs162/wk10/pointersOnly/pointersOnly.cc new file mode 100644 index 0000000..31b6f35 --- /dev/null +++ b/cs162/wk10/pointersOnly/pointersOnly.cc @@ -0,0 +1,40 @@ +#include + +void inputFeetAndInches(double *, double *); +void feetAndInchesToMeters(const double *, const double *, double *); +void outputFeetInchesAndMeters(const double *, const double *, const double *); + +int main() { + auto *feet = new double; + auto *inches = new double; + auto *meters = new double; + + inputFeetAndInches(feet, inches); + feetAndInchesToMeters(feet, inches, meters); + outputFeetInchesAndMeters(feet, inches, meters); + + delete feet; + delete inches; + delete meters; + + return 0; +} + +void inputFeetAndInches(double *feet, double *inches) { + std::cout << "feet: "; + std::cin >> *feet; + std::cout << "inches: "; + std::cin >> *inches; +} + +void feetAndInchesToMeters(const double *feet, const double *inches, + double *meters) { + *meters = ((*feet * 12) + *inches) * 0.0254; +} + +void outputFeetInchesAndMeters(const double *feet, const double *inches, + const double *meters) { + std::cout << "feet: " << *feet << '\n' + << "inches: " << *inches << '\n' + << "meters: " << *meters << std::endl; +} diff --git a/cs162/wk2/BUILD b/cs162/wk2/BUILD new file mode 100644 index 0000000..cde7d85 --- /dev/null +++ b/cs162/wk2/BUILD @@ -0,0 +1,26 @@ +cc_binary( + name = "dictionaryRead", + srcs = glob([ + "dictionaryRead/**/*.cc", + "dictionaryRead/**/*.hh", + ]), + data = ["//data:words.txt"], +) + +cc_binary( + name = "friendsFile", + srcs = glob([ + "friendsFile/**/*.cc", + "friendsFile/**/*.hh", + ]), + data = ["//data:nums.txt"], +) + +filegroup( + name = "build_all", + srcs = [ + "dictionaryRead", + "friendsFile", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk2/CMakeLists.txt b/cs162/wk2/CMakeLists.txt new file mode 100644 index 0000000..da2cb80 --- /dev/null +++ b/cs162/wk2/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(friendsFile) +add_subdirectory(dictionaryRead) diff --git a/cs162/wk2/dictionaryRead/CMakeLists.txt b/cs162/wk2/dictionaryRead/CMakeLists.txt new file mode 100644 index 0000000..827784a --- /dev/null +++ b/cs162/wk2/dictionaryRead/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk2_dictionaryRead) + +add_executable(wk2_dictionaryRead dictionaryRead.cc) diff --git a/cs162/wk2/dictionaryRead/dictionaryRead.cc b/cs162/wk2/dictionaryRead/dictionaryRead.cc new file mode 100644 index 0000000..e911543 --- /dev/null +++ b/cs162/wk2/dictionaryRead/dictionaryRead.cc @@ -0,0 +1,31 @@ +#include +#include + +int main() { + // Declare variables + std::string userWord; + std::ifstream wordsFile("data/words.txt", std::ifstream::in); + std::string currentWord; + + // Get user's word + std::cout << "Enter a word: "; + std::cin >> userWord; + + // Check lines for word + while (!wordsFile.eof()) { + wordsFile >> currentWord; + + // Check if line is word + if (currentWord == userWord) { + std::cout << "That word is spelled correctly." << std::endl; + + wordsFile.close(); + return 0; + } + } + + std::cout << "That word is not spelled correctly." << std::endl; + + wordsFile.close(); + return 0; +} diff --git a/cs162/wk2/friendsFile/CMakeLists.txt b/cs162/wk2/friendsFile/CMakeLists.txt new file mode 100644 index 0000000..4140119 --- /dev/null +++ b/cs162/wk2/friendsFile/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk2_friendsFile) + +add_executable(wk2_friendsFile friendsFile.cc) diff --git a/cs162/wk2/friendsFile/friendsFile.cc b/cs162/wk2/friendsFile/friendsFile.cc new file mode 100644 index 0000000..c132165 --- /dev/null +++ b/cs162/wk2/friendsFile/friendsFile.cc @@ -0,0 +1,57 @@ +#include +#include +#include + +int main() { + // Declare variables + std::ofstream outputFile("data/nums.txt", std::ofstream::out); + std::string userFirstLastName; + std::string userAddress; + std::string userPhoneNumber; + std::string currentFirstLastName; + std::string currentAddress; + std::string currentPhoneNumber; + + // Output information + std::cout << "Enter the names (first and last), phone numbers, and addresses " + "of three friends.\n" + << std::endl; + + for (int i = 1; i < 4; ++i) { + // Get friends' information + std::cout << '#' << i << " First and last name: "; + std::getline(std::cin, userFirstLastName); + std::cout << '#' << i << " Address: "; + std::getline(std::cin, userAddress); + std::cout << '#' << i << " Phone number: "; + std::getline(std::cin, userPhoneNumber); + + // Write friends' data + outputFile << userFirstLastName << '\n' + << userAddress << '\n' + << userPhoneNumber; + + if (i < 3) { + outputFile << '\n'; + } + } + + outputFile.close(); + + std::ifstream inputFile("data/nums.txt", std::ifstream::in); + + std::cout << "\nRecords: " << std::endl; + + // Read and output user's friends + while (!inputFile.eof()) { + std::getline(inputFile, currentFirstLastName); + std::getline(inputFile, currentAddress); + std::getline(inputFile, currentPhoneNumber); + + std::cout << currentFirstLastName << ", " << currentAddress << ", " + << currentPhoneNumber << std::endl; + } + + inputFile.close(); + return 0; +} diff --git a/cs162/wk3/BUILD b/cs162/wk3/BUILD new file mode 100644 index 0000000..dfe23a9 --- /dev/null +++ b/cs162/wk3/BUILD @@ -0,0 +1,15 @@ +cc_binary( + name = "musicStruct", + srcs = glob([ + "musicStruct/**/*.cc", + "musicStruct/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "musicStruct", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk3/CMakeLists.txt b/cs162/wk3/CMakeLists.txt new file mode 100644 index 0000000..9804ee6 --- /dev/null +++ b/cs162/wk3/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(musicStruct) diff --git a/cs162/wk3/musicStruct/CMakeLists.txt b/cs162/wk3/musicStruct/CMakeLists.txt new file mode 100644 index 0000000..80b2d2e --- /dev/null +++ b/cs162/wk3/musicStruct/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk3_musicStruct) + +add_executable(wk3_musicStruct musicStruct.cc) diff --git a/cs162/wk3/musicStruct/musicStruct.cc b/cs162/wk3/musicStruct/musicStruct.cc new file mode 100644 index 0000000..5c17839 --- /dev/null +++ b/cs162/wk3/musicStruct/musicStruct.cc @@ -0,0 +1,168 @@ +#include +#include +#include +#include + +// A structure to hold information about a CD +struct CD { + std::string title; + std::vector performers; + size_t tracks; + size_t playtime; + char genre; +}; + +// Fill a `CD` with information +void fillCd(CD &); +// Query a set of CDs based on certain criteria +std::vector search(const std::vector &, int, const std::string &); +// Display a set of CDs +void displayCds(const std::vector &); + +int main() { + // Declare and initialise variables + size_t cdCount = 0; + std::vector cds = {{}, {}, {}, {}}; + int searchType; + std::string searchQuery; + + // Get CD amount + do { + std::cout << "How many CDs do you have? (Minimum of three) "; + std::cin >> cdCount; + } while (cdCount < 3); + std::cin.ignore(1024, '\n'); + std::cout << std::endl; + + // Fill CDs + for (int i = 0; i < cdCount; ++i) { + std::cout << "CD " << i + 1 << " of " << cdCount + << ":\n==========" << std::endl; + + fillCd(cds[i]); + } + + // Get CD search query type + std::cout << "What type of search would you like to perform?\n" + "0 = artist\n" + "1 = genre\n" + "> "; + std::cin >> searchType; + + // Get CD search query + std::cout << "What would you like to search? "; + std::cin.ignore(1024, '\n'); + std::getline(std::cin, searchQuery); + std::cout << std::endl; + + // Filter CDs based ons search criteria + std::vector filtered_cds = search(cds, searchType, searchQuery); + + // Display CDs that matched search criteria + displayCds(filtered_cds); + + return 0; +} + +void fillCd(CD &cd) { + // Get CD title + std::cout << "What is the title of the CD? "; + std::getline(std::cin, cd.title); + + // Get CD performers + + // Initialise CD with a maximum of four performers + cd.performers = {{}, {}, {}, {}}; + for (int i = 0; i < 4; ++i) { + std::string author; + + // Get CD performer + std::cout << "Who is performer " << i + 1 + << " of 4 of the CD? (0 to cancel) "; + std::getline(std::cin, author); + + if (author == "0") { + break; + } else { + cd.performers[i] = author; + } + } + + // Get CD tracks + std::cout << "What is the number of tracks on the CD? "; + std::cin >> cd.tracks; + + // Get CD playtime + std::cout << "What is the total playtime of the CD? "; + std::cin >> cd.playtime; + + // Get CD genre + std::cout << "What is the genre of the CD? "; + std::cin >> cd.genre; + + std::cin.ignore(1024, '\n'); + + std::cout << std::endl; +} + +std::vector search(const std::vector &cds, int by, + const std::string &query) { + std::vector found_cds; + + // Query based on query type + if (by == 0) { + // Find CDs where a performer matches the query + for (const CD &cd : cds | std::views::filter([&](const CD &cd) -> bool { + bool contains = false; + + for (auto performer : cd.performers) { + if (query == performer) { + contains = true; + } + } + + return contains; + })) { + found_cds.emplace_back(cd); + } + } else { + // Find CDs where the genre matches the query + for (const CD &cd : cds | std::views::filter([&](const CD &cd) -> bool { + return cd.genre == query[0]; + })) { + found_cds.emplace_back(cd); + } + } + + return found_cds; +} + +void displayCds(const std::vector &filtered_cds) { + if (filtered_cds.empty()) { + std::cout << "No CDs where found based on your query!" << std::endl; + } else { + std::cout << filtered_cds.size() + << " CDs where found based on your query:" << std::endl; + + for (int i = 0; i < filtered_cds.size(); ++i) { + // Output number and title + std::cout << "CD #" << i + 1 << ":\n=====" << std::endl; + std::cout << "Title: " << filtered_cds[i].title << std::endl; + + // Output authors + for (int j = 0; j < filtered_cds[i].performers.size(); ++j) { + std::string performer = filtered_cds[i].performers[j]; + + if (!performer.empty()) { + std::cout << "Author #" << j + 1 << ": " << performer << std::endl; + } + } + + // Output tracks, playtime, and genre + std::cout << "Tracks: " << filtered_cds[i].tracks << '\n' + << "Playtime: " << filtered_cds[i].playtime << '\n' + << "Genre: " << filtered_cds[i].genre << '\n' + << std::endl; + } + } +} diff --git a/cs162/wk4/BUILD b/cs162/wk4/BUILD new file mode 100644 index 0000000..7c82b2b --- /dev/null +++ b/cs162/wk4/BUILD @@ -0,0 +1,15 @@ +cc_binary( + name = "dateClass", + srcs = glob([ + "dateClass/**/*.cc", + "dateClass/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "dateClass", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk4/CMakeLists.txt b/cs162/wk4/CMakeLists.txt new file mode 100644 index 0000000..c63f514 --- /dev/null +++ b/cs162/wk4/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(dateClass) diff --git a/cs162/wk4/dateClass/CMakeLists.txt b/cs162/wk4/dateClass/CMakeLists.txt new file mode 100644 index 0000000..23dc066 --- /dev/null +++ b/cs162/wk4/dateClass/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk4_dateClass) + +add_executable(wk4_dateClass testDate.cc date.cc) diff --git a/cs162/wk4/dateClass/date.cc b/cs162/wk4/dateClass/date.cc new file mode 100644 index 0000000..b3b52b8 --- /dev/null +++ b/cs162/wk4/dateClass/date.cc @@ -0,0 +1,79 @@ +#include "date.hh" + +// Public constructor to initialise private variables upon construction +Date::Date(unsigned int _month, unsigned int _day, unsigned int _year) { + this->month = _month; + this->day = _day; + this->year = _year; +} + +// Public getters to get private variables +unsigned int Date::getMonth() const { return this->month; } +unsigned int Date::getDay() const { return this->day; } +unsigned int Date::getYear() const { return this->year; } +unsigned int Date::getJulian() const { + // https://quasar.as.utexas.edu/BillInfo/JulianDatesG.html + int A = static_cast(this->year) / 100; + int B = A / 4; + int C = 2 - A + B; + double E = 365.25 * (this->year + 4716); + double F = 30.6001 * (this->month + 1); + + // https://www.aavso.org/jd-calculator + return static_cast(C + this->day + E + F - 1524.5); +} + +// Public setters to set private variables +void Date::setMonth(unsigned int _month) { this->month = _month; } +void Date::setDay(unsigned int _day) { this->day = _day; } +void Date::setYear(unsigned int _year) { this->year = _year; } +void Date::set(unsigned int _month, unsigned int _day, unsigned int _year) { + this->month = _month; + this->day = _day; + this->year = _year; +} + +// Public function which returns `month` as an `std::string` +std::string Date::monthAsString() const { + switch (this->month) { + case 1: { + return "January"; + } + case 2: { + return "February"; + } + case 3: { + return "March"; + } + case 4: { + return "April"; + } + case 5: { + return "May"; + } + case 6: { + return "June"; + } + case 7: { + return "July"; + } + case 8: { + return "August"; + } + case 9: { + return "September"; + } + case 10: { + return "October"; + } + case 11: { + return "November"; + } + case 12: { + return "December"; + } + default: { + return "Unknown"; + } + } +} diff --git a/cs162/wk4/dateClass/date.hh b/cs162/wk4/dateClass/date.hh new file mode 100644 index 0000000..1aead8f --- /dev/null +++ b/cs162/wk4/dateClass/date.hh @@ -0,0 +1,35 @@ +#ifndef DATE_HH +#define DATE_HH + +#include + +// Date class to keep track of a date +class Date { +private: + // Private variables to keep track of date + unsigned int month; + unsigned int day; + unsigned int year; + +public: + // Public constructors to initialise private variables upon construction + Date() : month(0), day(0), year(0) {} + Date(unsigned int _month, unsigned int _day, unsigned int _year); + + // Public getters to get private variables + [[nodiscard]] unsigned int getMonth() const; + [[nodiscard]] unsigned int getDay() const; + [[nodiscard]] unsigned int getYear() const; + [[nodiscard]] unsigned int getJulian() const; + + // Public setters to set private variables + void setMonth(unsigned int _month); + void setDay(unsigned int _day); + void setYear(unsigned int _year); + void set(unsigned int _month, unsigned int _day, unsigned int _year); + + // Public function which returns `month` as an `std::string` + [[nodiscard]] std::string monthAsString() const; +}; + +#endif // DATE_HH diff --git a/cs162/wk4/dateClass/testDate.cc b/cs162/wk4/dateClass/testDate.cc new file mode 100644 index 0000000..4c80bdf --- /dev/null +++ b/cs162/wk4/dateClass/testDate.cc @@ -0,0 +1,58 @@ +#include + +#include "date.hh" + +int main() { + // Test `Date` class with default constructor + { + Date date; + + std::cout << "date after default constructor:\n" + << " month = " << date.getMonth() << '\n' + << " day = " << date.getDay() << '\n' + << " year = " << date.getYear() << '\n' + << std::endl; + } + + { + // Test `Date` class with overloaded constructor + Date date(1, 2, 3); + + std::cout << "date after overloaded constructor:\n" + << " month = " << date.getMonth() << '\n' + << " day = " << date.getDay() << '\n' + << " year = " << date.getYear() << '\n' + << std::endl; + + // Test `Date` class with mutator functions + date.setMonth(4); + date.setDay(5); + date.setYear(6); + + std::cout << "date after using mutator functions:\n" + << " month = " << date.getMonth() << '\n' + << " day = " << date.getDay() << '\n' + << " year = " << date.getYear() << '\n' + << std::endl; + + date.set(7, 8, 9); + + // Test `Date` class with `set` + std::cout << "date after using mutator function set:\n" + << " month = " << date.getMonth() << '\n' + << " day = " << date.getDay() << '\n' + << " year = " << date.getYear() << '\n' + << std::endl; + + // Test `Date` class with `monthAsString` + std::cout << "date's month after using monthAsString: " + << date.monthAsString() << '\n' + << std::endl; + + // Test `Date` class with `julian` + std::cout << "date's month after using julian: " << date.getJulian() + << std::endl; + } + + return 0; +} diff --git a/cs162/wk5/BUILD b/cs162/wk5/BUILD new file mode 100644 index 0000000..efcab31 --- /dev/null +++ b/cs162/wk5/BUILD @@ -0,0 +1,24 @@ +cc_binary( + name = "country", + srcs = glob([ + "country/**/*.cc", + "country/**/*.hh", + ]), +) + +cc_binary( + name = "gradesHelpers", + srcs = glob([ + "gradesHelpers/**/*.cc", + "gradesHelpers/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "country", + "gradesHelpers", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk5/CMakeLists.txt b/cs162/wk5/CMakeLists.txt new file mode 100644 index 0000000..7752b0f --- /dev/null +++ b/cs162/wk5/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(country) +add_subdirectory(gradesHelpers) diff --git a/cs162/wk5/country/CMakeLists.txt b/cs162/wk5/country/CMakeLists.txt new file mode 100644 index 0000000..57d984b --- /dev/null +++ b/cs162/wk5/country/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk5_country) + +add_executable(wk5_country country.cc testCountry.cc) diff --git a/cs162/wk5/country/country.cc b/cs162/wk5/country/country.cc new file mode 100644 index 0000000..cbc0bc1 --- /dev/null +++ b/cs162/wk5/country/country.cc @@ -0,0 +1,22 @@ +#include "country.hh" + +float Country::futurePop() const { return this->population * 1.05f * 10.f; } + +// Figure out which of the countries have the largest population +Country Country::largestCountry(Country country2, Country country3) { + if ((this->population >= country2.population) && + (this->population >= country3.population)) { + return *this; + } else if ((country2.population >= this->population) && + (country2.population >= country3.population)) { + return country2; + } else { + return country3; + } +} + +void Country::resetValues(const Country &country) { + this->name = country.name; + this->capital = country.capital; + this->population = country.population; +} diff --git a/cs162/wk5/country/country.hh b/cs162/wk5/country/country.hh new file mode 100644 index 0000000..66bdf1f --- /dev/null +++ b/cs162/wk5/country/country.hh @@ -0,0 +1,54 @@ +#ifndef COUNTRY_HH +#define COUNTRY_HH +#pragma once + +#include +#include + +class Country { +private: + // Member variables + // + // I shared this... + std::string name; + std::string capital; + float population; + +public: + // Constructor + // + // this... + explicit Country(std::string _name = "Unknown", + std::string _capital = "Unknown", float _population = 0) + : name(std::move(_name)), capital(std::move(_capital)), + population(_population) {} + + // Destructor + // + // and this to my breakout room! Hope they learned from it! + ~Country() = default; // Quite literally `{}` + + // Accessors + std::string getName() { return this->name; } + std::string getCapital() { return this->capital; } + [[nodiscard]] float getPopulation() const { return this->population; } + + // Mutators + void setName(std::string _name) { this->name = std::move(_name); } + void setCapital(std::string _capital) { this->capital = std::move(_capital); } + void setPopulation(float _population) { this->population = _population; } + + // Predict the population in ten years + [[nodiscard]] float futurePop() const; + + // Return the largest of three populations + // + // I wish these would have been `const` references, since they are copied for + // each invocation but only used as a `const` references. + Country largestCountry(Country, Country); + + // Reset the values + void resetValues(const Country &); +}; + +#endif // COUNTRY_HH diff --git a/cs162/wk5/country/testCountry.cc b/cs162/wk5/country/testCountry.cc new file mode 100644 index 0000000..ba061f3 --- /dev/null +++ b/cs162/wk5/country/testCountry.cc @@ -0,0 +1,103 @@ +#include +#include + +#include "country.hh" + +// Print a countries name, capital, and population +void printCountry(Country); +// A test adapter which informs of context and executes a test in the form of a +// lambda, then, asserts if the test was successful. +void testContext(const std::string &, const std::function &); + +int main() { + // "populate a Country object with values for name, capital and population" + Country country("United States of America", "Washington D.C.", + 326.69f); // 326.69 + + testContext("\"populate a Country object with values for name, capital and " + "population\"", + // Separate ... *anonymous* ... functions + [&]() -> bool { + printCountry(country); + + return country.getName() == "United States of America"; + }); + testContext( + "\"print the values held in a Country object - in a function in the " + "driver file\"", + [&]() -> bool { + printCountry(country); + + return country.getCapital() == "Washington D.C."; + }); + testContext("\"test resetting the values of a County ( sample function call: " + "myCountry." + "resetValues(yourCountry); )\"", + [&]() -> bool { + country.resetValues( + Country("Hungary", "Budapest", 9.67f)); // 9.67 + printCountry(country); + + return country.getName() == "Hungary"; + }); + testContext( + "\"test the function that returns the population increase of a Country " + "specified by the user\"", + [&]() -> bool { + float futurePop = country.futurePop(); + + std::cout << futurePop << std::endl; + + return futurePop == country.getPopulation() * 1.05f * 10.f; + }); + testContext("\"test the function that returns the Country with largest " + "population (of " + "3)\"", + [&]() -> bool { + Country country2 = + Country("Not the largest", "Not even close", 0); + Country country3 = Country("Still not the largest", + "Still not even close", 3021); + float largest = + country.largestCountry(country2, country3).getPopulation(); + + std::cout << "Country #1: " << country.getPopulation() << '\n' + << "Country #2: " << country2.getPopulation() << '\n' + << "Country #3: " << country3.getPopulation() << '\n' + << "Largest: " << largest << std::endl; + + return largest == 3021; + }); + testContext("test setters", [&]() -> bool { + country.setName("1"); + country.setCapital("2"); + country.setPopulation(3); + + printCountry(country); + + return country.getName() == "1"; + }); + + return 0; +} + +void testContext(const std::string &context, + const std::function &function) { + std::cout << context << std::endl; + + bool test_result = function(); + + if (test_result) { + std::cout << "test was successful" << std::endl; + } else { + std::cout << "test was unsuccessful" << std::endl; + } + + std::cout << std::endl; +} + +void printCountry(Country country) { + std::cout << "Name: " << country.getName() << '\n' + << "Capital: " << country.getCapital() << '\n' + << "Population: " << country.getPopulation() << std::endl; +} \ No newline at end of file diff --git a/cs162/wk5/gradesHelpers/CMakeLists.txt b/cs162/wk5/gradesHelpers/CMakeLists.txt new file mode 100644 index 0000000..ce034f0 --- /dev/null +++ b/cs162/wk5/gradesHelpers/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk5_gradesHelpers) + +add_executable(wk5_gradesHelpers grades.cc testGrades.cc) diff --git a/cs162/wk5/gradesHelpers/grades.cc b/cs162/wk5/gradesHelpers/grades.cc new file mode 100644 index 0000000..35bf753 --- /dev/null +++ b/cs162/wk5/gradesHelpers/grades.cc @@ -0,0 +1,64 @@ +#include "grades.hh" + +Grades::Grades() { defaultTests(); } + +void Grades::computeAverage() { + int testAccumulated = 0; + + // Total up all test scores + for (int &test : this->testScores) { + testAccumulated += test; + } + + // Find the average by dividing the total test scores by the amount of test + // scores + this->averageScore = + static_cast(testAccumulated) / static_cast(this->tests); +} + +void Grades::checkLowest(int score) { + // If the test new `score` is lower than the `lowestScore`, make it the new + // lowest score + if (score < this->lowestScore) { + this->lowestScore = score; + } +} + +bool Grades::validScore(int score) { + // If the new `score` is within the range 0 - 100, mark it as valid + return 0 <= score && score <= 100; +} + +bool Grades::checkNumTests() const { + // If the number of tests is less than the max number of test, inform the + // caller that they may add a new test score + return this->tests < Grades::MAX_TESTS; +} + +void Grades::defaultTests() { + // Initialises all test scores to zero + for (int &test : this->testScores) { + test = 0; + } +} + +void Grades::addTest(int newTest) { + // If the number of tests is less than the max number of tests... + if (this->checkNumTests()) { + // and if the `newTest` is within the range 0 - 100... + if (this->validScore(newTest)) { + // track the `newTest`, ... + this->testScores[this->tests] = newTest; + // make sure we know that we added a `newTest`, ... + this->tests += 1; + + // compute the new average of all test scores, ... + this->computeAverage(); + // and check, possibly assigning, if the new test is the lowest of + // all tests scores. + this->checkLowest(newTest); + } + } +} + +float Grades::getAverage() const { return this->averageScore; } diff --git a/cs162/wk5/gradesHelpers/grades.hh b/cs162/wk5/gradesHelpers/grades.hh new file mode 100644 index 0000000..89e1022 --- /dev/null +++ b/cs162/wk5/gradesHelpers/grades.hh @@ -0,0 +1,41 @@ +#ifndef GRADES_HH +#define GRADES_HH +#pragma once + +#include + +class Grades { +private: + /// Maximum amount of `testScores` + static const size_t MAX_TESTS = 4; + /// All test scores + int testScores[MAX_TESTS]{}; + /// The lowest score of all test scores + int lowestScore = std::numeric_limits::max(); + /// The average of all test scores + float averageScore = 0.0; + /// The amount of tests kept track of + size_t tests = 0; + + /// Computes the average every time a new test is added + void computeAverage(); + /// Checks to see if test added has the lowest score. + void checkLowest(int); + /// Before a test is added to the array, its value is checked to make sure + /// the score is in the range 0 - 100, inclusive + static bool validScore(int); + /// Used to make sure the array is not full before adding a score + [[nodiscard]] bool checkNumTests() const; + /// Initialises value in the array of tests to zero + void defaultTests(); + +public: + Grades(); + + /// Add another test score to keep track of + void addTest(int); + /// Get the average of all test scores + [[nodiscard]] float getAverage() const; +}; + +#endif // GRADES_HH diff --git a/cs162/wk5/gradesHelpers/testGrades.cc b/cs162/wk5/gradesHelpers/testGrades.cc new file mode 100644 index 0000000..04a38cc --- /dev/null +++ b/cs162/wk5/gradesHelpers/testGrades.cc @@ -0,0 +1,53 @@ +#include +#include + +#include "grades.hh" + +/// Tests `Grades` given a few grades, an expected average, and if the test +/// should fail. +void test(const std::vector &, float, bool); + +int main() { + { + test({80, 70, 90, 10, 10}, 62.5, + false); // Test if `checkNumTests` works + test({80, 70, 90, 10}, 62.5, false); + test({80, 70, 90}, 80, false); + test({80, 70, 90}, 70, true); + test({80, 70}, 75, false); + test({80}, 80, false); + test({80}, 70, true); + } + + // This works too. + { + Grades cs162; + + cs162.addTest(80); + cs162.addTest(70); + cs162.addTest(90); + cs162.addTest(10); + + std::cout << cs162.getAverage() << std::endl; + } + + return 0; +} + +void test(const std::vector &values, float expect, bool shouldFail) { + Grades cs162; + + std::cout << "testing getAverage with [ "; + + for (int grade : values) { + std::cout << grade << " "; + + cs162.addTest(grade); + } + + std::cout << ((cs162.getAverage() == expect && !shouldFail || + cs162.getAverage() != expect && shouldFail) + ? "]: pass" + : "]: fail") + << std::endl; +} diff --git a/cs162/wk6/BUILD b/cs162/wk6/BUILD new file mode 100644 index 0000000..6442ad9 --- /dev/null +++ b/cs162/wk6/BUILD @@ -0,0 +1,24 @@ +cc_binary( + name = "friends", + srcs = glob([ + "friends/**/*.cc", + "friends/**/*.hh", + ]), +) + +cc_binary( + name = "overload", + srcs = glob([ + "overload/**/*.cc", + "overload/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "friends", + "overload", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk6/CMakeLists.txt b/cs162/wk6/CMakeLists.txt new file mode 100644 index 0000000..4c5a63d --- /dev/null +++ b/cs162/wk6/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(friends) +add_subdirectory(overload) diff --git a/cs162/wk6/friends/CMakeLists.txt b/cs162/wk6/friends/CMakeLists.txt new file mode 100644 index 0000000..06eadd6 --- /dev/null +++ b/cs162/wk6/friends/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk6_friends) + +add_executable(wk6_friends bankAccount.cc testBankAccount.cc) diff --git a/cs162/wk6/friends/bankAccount.cc b/cs162/wk6/friends/bankAccount.cc new file mode 100644 index 0000000..ede21f8 --- /dev/null +++ b/cs162/wk6/friends/bankAccount.cc @@ -0,0 +1,43 @@ +#include "bankAccount.hh" + +#include + +bool BankAccount::withdraw(float amount) { + bool canWithdraw = true; + + if (amount <= this->balance) { + this->balance -= amount; + } else { + canWithdraw = false; + } + + return canWithdraw; +} + +float BankAccount::computeInterest(float interestRate) const { + if (this->balance > 0) { + return this->balance * interestRate; + } else { + return 0; + } +} + +std::string BankAccount::greaterBalance(BankAccount &bankAccount) { + if (this->balance > bankAccount.balance) { + return this->accountNumber; + } else { + return bankAccount.accountNumber; + } +} + +void printAccount(const BankAccount &bankAccount) { + std::cout << bankAccount.accountNumber << std::endl; + std::cout << bankAccount.balance << std::endl; +} + +BankAccount combineAccounts(const BankAccount &bankAccount1, + const BankAccount &bankAccount2) { + return BankAccount(std::to_string(std::stoi(bankAccount1.accountNumber) + + std::stoi(bankAccount2.accountNumber)), + bankAccount1.balance + bankAccount2.balance); +} diff --git a/cs162/wk6/friends/bankAccount.hh b/cs162/wk6/friends/bankAccount.hh new file mode 100644 index 0000000..e85ae47 --- /dev/null +++ b/cs162/wk6/friends/bankAccount.hh @@ -0,0 +1,42 @@ +#ifndef BANK_ACCOUNT_HH +#define BANK_ACCOUNT_HH +#pragma once + +#include +#include + +class BankAccount { +private: + std::string accountNumber; + float balance; + +public: + // Overloaded default constructor + explicit BankAccount(std::string _accountNumber = "", float _balance = 0.0) + : accountNumber(std::move(_accountNumber)), balance(_balance) {} + + // Accessors + std::string getAccountNumber() { return this->accountNumber; } + [[nodiscard]] float getBalance() const { return this->balance; } + + // Mutators + void setAccountNumber(std::string _accountNumber) { + this->accountNumber = std::move(_accountNumber); + } + void setBalance(float _balance) { this->balance = _balance; } + void deposit(float amount) { this->balance += amount; } + bool withdraw(float); + + // Member functions + [[nodiscard]] float computeInterest(float) const; + std::string greaterBalance(BankAccount &); + + /// Prints out the account number and balance of the parameterized + /// `BankAccount`. + friend void printAccount(const BankAccount &); + /// Combines the balances in two `BankAccount`s into a new `BankAccount`, + /// which is returned. + friend BankAccount combineAccounts(const BankAccount &, const BankAccount &); +}; + +#endif // BANK_ACCOUNT_HH diff --git a/cs162/wk6/friends/testBankAccount.cc b/cs162/wk6/friends/testBankAccount.cc new file mode 100644 index 0000000..10943bc --- /dev/null +++ b/cs162/wk6/friends/testBankAccount.cc @@ -0,0 +1,39 @@ +#include + +#include "bankAccount.hh" + +int main() { + BankAccount bankAccount("1234", 100.00); + bool canWithdraw; + + bankAccount.deposit(25.00); + + canWithdraw = bankAccount.withdraw(10.00); + + if (!canWithdraw) { + std::cout << "You cannot withdraw that amount." << std::endl; + } + + std::cout << bankAccount.getAccountNumber() << std::endl; + std::cout << bankAccount.getBalance() << std::endl; + + BankAccount bankAccount2; + + bankAccount2.setBalance(200.00); + bankAccount2.setAccountNumber("4321"); + + std::cout << bankAccount2.getAccountNumber() << std::endl; + std::cout << bankAccount2.getBalance() << std::endl; + + std::cout << "If the interest rate is 5%, you would earn " + << bankAccount2.computeInterest(0.05f) << " in one year.\n" + << std::endl; + + std::cout << bankAccount.greaterBalance(bankAccount2) + << " has a higher balance." << std::endl; + + printAccount(bankAccount); + printAccount(combineAccounts(bankAccount, bankAccount2)); + + return 0; +} \ No newline at end of file diff --git a/cs162/wk6/overload/CMakeLists.txt b/cs162/wk6/overload/CMakeLists.txt new file mode 100644 index 0000000..683c7a6 --- /dev/null +++ b/cs162/wk6/overload/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk6_overload) + +add_executable(wk6_overload shape.cc testShape.cc) diff --git a/cs162/wk6/overload/shape.cc b/cs162/wk6/overload/shape.cc new file mode 100644 index 0000000..36e5856 --- /dev/null +++ b/cs162/wk6/overload/shape.cc @@ -0,0 +1,74 @@ +#define _USE_MATH_DEFINES + +#include "shape.hh" + +#include + +char Shape::getType() const { return this->type; } + +unsigned int Shape::getDimension() const { return this->dimension; } + +float Shape::getArea() const { return this->area; } + +void Shape::setType(char _shapeLetter) { + if (_shapeLetter == 'c' || _shapeLetter == 's' || _shapeLetter == 'h') { + this->type = _shapeLetter; + } +} + +void Shape::setDimension(unsigned int _dimension) { + // Even though this function takes in an `unsigned int`, we make sure that + // the + // `_dimension` is greater than zero. This is in case the user is using a + // compiler or CXX-flags that do not treat sign mismatches as errors... like + // they always should... + if (_dimension > 0) { + this->dimension = _dimension; + + this->computeArea(); + } +} + +void Shape::computeArea() { + switch (this->type) { + case 'c': { + this->area = static_cast(M_PI * std::pow(2, this->dimension)); + } break; + case 's': { + this->area = static_cast(this->dimension * this->dimension); + } break; + case 'h': { + this->area = static_cast((6 * (this->dimension * this->dimension)) / + (4 * std::tan((M_PI / 6)))); + } break; + } +} + +bool Shape::operator==(Shape shape) const { + return this->type == shape.type && this->dimension == shape.dimension; +} + +void Shape::operator+=(Shape shape) { + if (this->type == shape.type) { + this->dimension += shape.dimension; + + this->computeArea(); + } +} + +bool Shape::operator!=(Shape shape) const { return !(*this == shape); } + +Shape Shape::operator+(Shape shape) { + if (*this == shape) { + Shape newShape; + + newShape.type = this->type; + newShape.dimension = this->dimension + shape.dimension; + + newShape.computeArea(); + + return newShape; + } else { + return *this; + } +} diff --git a/cs162/wk6/overload/shape.hh b/cs162/wk6/overload/shape.hh new file mode 100644 index 0000000..f12a615 --- /dev/null +++ b/cs162/wk6/overload/shape.hh @@ -0,0 +1,45 @@ +#ifndef SHAPE_HH +#define SHAPE_HH + +class Shape { +private: + // c, s, or h + char type; + unsigned int dimension; + float area; + +public: + // The wording "default values for the private member variables" was a little + // of to me knowing that in the past we've been using function overloading + // for constructors. I just went ahead and implemented both but kept the one + // that made the most sense in terms of how it was worded. + Shape() : type('n'), dimension(0), area(0){}; + /* explicit Shape(char _type = 'n', unsigned int _dimension = 0, float _area + = 0) : type(_type), dimension(_dimension), area(_area) {}; */ + + // Getters for the three private member variables + [[nodiscard]] char getType() const; + [[nodiscard]] unsigned int getDimension() const; + [[nodiscard]] float getArea() const; + + // Setters for `type` and `dimensions` + // + // These *should* `throw`, but that's just bad practice. + // + // These *could* implement C-like error handling, but that's just + // overcomplicating things. + void setType(char); + void setDimension(unsigned int); + + // Operator overloads + bool operator==(Shape) const; + void operator+=(Shape); + bool operator!=(Shape) const; + Shape operator+(Shape); + +private: + // Area computer + void computeArea(); +}; + +#endif // SHAPE_HH diff --git a/cs162/wk6/overload/testShape.cc b/cs162/wk6/overload/testShape.cc new file mode 100644 index 0000000..fbc8ca8 --- /dev/null +++ b/cs162/wk6/overload/testShape.cc @@ -0,0 +1,76 @@ +#include + +#include "shape.hh" + +/* + * # Test Plan + * + * This test plan uses a test framework. + * + * The test framework gives accurate context. + * + * - Test instantiation of `Shape` + * - Test all setters of `Shape` + * - Test all getters of `Shape` + * - Test all valid types: c, s, or h + * - Test two different dimensions for each valid type + */ + +#define INIT_TESTS() \ + int __tested = 0; \ + int __passed = 0; +#define TESTED __tested +#define PASSED __passed + +#define TEST(context, shape, type, dimension, expected) \ + { \ + if (test(context, shape, type, dimension, expected)) { \ + __passed += 1; \ + } \ + __tested += 1; \ + } + +bool test(const std::string &, Shape, char, unsigned int, float); + +int main() { + Shape shape; + + INIT_TESTS() + + TEST("circle with radius of two", shape, 'c', 2, 12.566f) + TEST("circle with radius of twelve", shape, 'c', 4, 50.27f) + TEST("square with side of two", shape, 's', 2, 4) + TEST("square with side of twelve", shape, 's', 12, 144) + TEST("hexagon with side of two", shape, 'h', 2, 10.392f) + TEST("hexagon with side of twelve", shape, 'h', 12, 374.1f) + // This should fail + TEST("hexagon with side of twelve, should fail", shape, 'h', 12, 376.1f) + + // There should be seven tests with six passing tests (because one was meant + // to fail). + std::cout << "! results\n" + << "> performed " << TESTED << " tests with " << PASSED + << " passing" << std::endl; + + return 0; +} + +bool test(const std::string &context, Shape shape, char type, + unsigned int dimension, float expected) { + shape.setType(type); + shape.setDimension(dimension); + + std::cout << "| " << context << std::endl; + + char newType = shape.getType(); + unsigned int newDimension = shape.getDimension(); + float area = shape.getArea(); + // ... + bool passed = static_cast(area) == static_cast(expected); + + std::cout << "> " << (passed ? "pass" : "fail") << ": expected " << expected + << ", got " << area << " using type \"" << newType + << "\" and dimension \"" << newDimension << "\"" << std::endl; + + return passed; +} diff --git a/cs162/wk7/BUILD b/cs162/wk7/BUILD new file mode 100644 index 0000000..6d6d52b --- /dev/null +++ b/cs162/wk7/BUILD @@ -0,0 +1,15 @@ +cc_binary( + name = "course", + srcs = glob([ + "course/**/*.cc", + "course/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "course", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk7/CMakeLists.txt b/cs162/wk7/CMakeLists.txt new file mode 100644 index 0000000..1a2e538 --- /dev/null +++ b/cs162/wk7/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(course) diff --git a/cs162/wk7/course/CMakeLists.txt b/cs162/wk7/course/CMakeLists.txt new file mode 100644 index 0000000..d6045de --- /dev/null +++ b/cs162/wk7/course/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.21) +project(wk7_course) + +add_executable(wk7_course course.cc student.cc testCourse.cc) diff --git a/cs162/wk7/course/course.cc b/cs162/wk7/course/course.cc new file mode 100644 index 0000000..bce09a4 --- /dev/null +++ b/cs162/wk7/course/course.cc @@ -0,0 +1,85 @@ +#include +#include + +#include "course.hh" + +[[maybe_unused]] std::string Course::getTitle() { return this->title; } + +[[maybe_unused]] std::string Course::getNumber() { return this->number; } + +[[maybe_unused]] float Course::getCredits() const { return this->credits; } + +void Course::setTitle(std::string _title) { this->title = std::move(_title); } + +void Course::setNumber(std::string _number) { + this->number = std::move(_number); +} + +void Course::setCredits(float _credits) { this->credits = _credits; } + +void Course::displayCourse() const { showCourse(*this); } + +bool Course::operator==(const Course &course) const { + return this->title == course.title && this->number == course.number && + this->credits == course.credits; +} + +Course &Course::operator+=(const Course &course) { + // CBA to implement overflow checks for an already messy C-array, involved + // operator that will only ever even add three new items at a time as + // expressed in the test file. + // + // Update: CBA to use C-arrays, just going to use the more versatile and + // simple `std::vector` STL container so the previous comment is + // non-applicable. + + // if (this->numStudents + course.numStudents > 30) { + // return *this; + // } + // + // auto *newStudentsEnrolled = static_cast(malloc( + // (this->numStudents + course.numStudents) * sizeof(sizeof(Student)))); + // + // memcpy(newStudentsEnrolled, this->studentsEnrolled, + // this->numStudents * sizeof(Student)); + // memcpy(newStudentsEnrolled + this->numStudents, course.studentsEnrolled, + // course.numStudents * sizeof(Student)); + // + // this->numStudents += course.numStudents; + + for (const Student &student : course.studentsEnrolled) { + if (this->numStudents + course.numStudents >= 30) { + break; + } + + this->studentsEnrolled.emplace_back(student); + + this->numStudents += 1; + } + + return *this; +} + +void showCourse(const Course &course) { + std::cout << "title: " << course.title << std::endl; + std::cout << "number: " << course.number << std::endl; + std::cout << "credits: " << course.credits << std::endl; + std::cout << "students: " << std::endl; + + for (Student student : course.studentsEnrolled) { + std::cout << " last name: " << student.getLastName() << std::endl; + std::cout << " first name: " << student.getFirstName() << std::endl; + std::cout << " id number: " << student.getIdNum() << '\n' << std::endl; + } + + std::cout << "number of students: " << course.numStudents << std::endl; +} + +void Course::addStudents(int studentNum, std::string *firstNames, + std::string *lastNames, int *idNums) { + for (int i = 0; i < studentNum; ++i) { + this->studentsEnrolled.emplace_back( + Student(firstNames[i], lastNames[i], idNums[i])); + this->numStudents += 1; + } +} diff --git a/cs162/wk7/course/course.hh b/cs162/wk7/course/course.hh new file mode 100644 index 0000000..df5f2cb --- /dev/null +++ b/cs162/wk7/course/course.hh @@ -0,0 +1,52 @@ +#ifndef COURSE_HH +#define COURSE_HH + +#include +#include +#include + +#include "student.hh" + +class Course { +public: + static const std::size_t MAX_STUDENTS = 30; + +private: + std::string title; + std::string number; + float credits; + // Student studentsEnrolled[Course::MAX_STUDENTS]; + std::vector studentsEnrolled; + std::size_t numStudents{}; + +public: + // Constructor + explicit Course(std::string _title = "", std::string _number = "", + float _credits = 0) + : title(std::move(_title)), number(std::move(_number)), + credits(_credits) {} + + // Getters + [[maybe_unused]] std::string getTitle(); + [[maybe_unused]] std::string getNumber(); + [[maybe_unused]] [[nodiscard]] float getCredits() const; + + // Setters + void setTitle(std::string); + void setNumber(std::string); + void setCredits(float); + + void displayCourse() const; + void addStudents(int, std::string[Course::MAX_STUDENTS], + std::string[Course::MAX_STUDENTS], + int[Course::MAX_STUDENTS]); + + // Operators + bool operator==(const Course &) const; + Course &operator+=(const Course &); + + // Friends + friend void showCourse(const Course &course); +}; + +#endif // COURSE_HH diff --git a/cs162/wk7/course/student.cc b/cs162/wk7/course/student.cc new file mode 100644 index 0000000..6add4f2 --- /dev/null +++ b/cs162/wk7/course/student.cc @@ -0,0 +1,21 @@ +#include + +#include "student.hh" + +std::string Student::getLastName() { return this->lastName; } + +std::string Student::getFirstName() { return this->firstName; } + +std::size_t Student::getIdNum() const { return this->idNum; } + +[[maybe_unused]] void Student::setLastName(std::string _lastName) { + this->lastName = std::move(_lastName); +} + +[[maybe_unused]] void Student::setFirstName(std::string _firstName) { + this->firstName = std::move(_firstName); +} + +[[maybe_unused]] void Student::setIdNum(std::size_t _idNum) { + this->idNum = _idNum; +} diff --git a/cs162/wk7/course/student.hh b/cs162/wk7/course/student.hh new file mode 100644 index 0000000..571a5e0 --- /dev/null +++ b/cs162/wk7/course/student.hh @@ -0,0 +1,30 @@ +#ifndef STUDENT_HH +#define STUDENT_HH + +#include + +class Student { +private: + std::string lastName; + std::string firstName; + std::size_t idNum; + +public: + // Constructor + explicit Student(std::string _lastName = "", std::string _firstName = "", + std::size_t _idNum = 0) + : lastName(std::move(_lastName)), firstName(std::move(_firstName)), + idNum(_idNum) {} + + // Getters + std::string getLastName(); + std::string getFirstName(); + [[nodiscard]] std::size_t getIdNum() const; + + // Setters + [[maybe_unused]] void setLastName(std::string); + [[maybe_unused]] void setFirstName(std::string); + [[maybe_unused]] void setIdNum(std::size_t); +}; + +#endif // STUDENT_HH diff --git a/cs162/wk7/course/testCourse.cc b/cs162/wk7/course/testCourse.cc new file mode 100644 index 0000000..e3e723b --- /dev/null +++ b/cs162/wk7/course/testCourse.cc @@ -0,0 +1,104 @@ +/******************************************************************************* + * Filename: wk7_courseDriver.cpp + * Summary: Program to test the Course class (which uses the Student class) + * Test program declares 2 Course objects, fills each with values, + * uses the += operator to copy the students from one Course into + * the other, and prints out the information about the 2 objects. + * Author: + * Date: + *******************************************************************************/ + +// There were only two instances where I had to replace something in this file +// to get it to work with my configuration, line 16, 20, and 69. As per my +// Emacs configuration, this file was also automatically formatted. Other than +// those changes, everything is 1:1 with the posted file. + +#include "course.hh" // Replaced #include "Course.h" +#include +#include +using std::cout, std::endl, std::cin; +using namespace std; // Added + +void enterCourseInfo(Course &); +// Prompts user to enter course title, designator, and credits +void enterStudents(Course &); +// Prompts user to enter up to 3 students + +const int MAX_STUDENTS = 3; + +int main() { + Course c1; + Course c2("Data Structures", "CS260", 4); // title, number, credits + + cout << "Testing the showCourse friend function\n"; + showCourse(c2); + cout << endl; + + cout << "Testing mutator functions\n"; + enterCourseInfo(c1); + showCourse(c1); + cout << endl; + + cout << "Testing the += operator\n"; + enterStudents(c2); + cout << "Before the += operator\n"; + showCourse(c1); + showCourse(c2); + c1 += c2; + cout << "After the += operator\n"; + showCourse(c1); + cout << endl; + + return 0; +} + +void enterCourseInfo(Course &crs) { + string userInput; + int creditIn; + + cout << "What is the course title? "; + getline(cin, userInput); + crs.setTitle(userInput); + + cout << "What is the course identifier? "; + getline(cin, userInput); + crs.setNumber(userInput); + + cout << "How many credits? "; + cin >> creditIn; + crs.setCredits(static_cast(creditIn)); + + enterStudents(crs); + + crs.displayCourse(); + + return; +} + +void enterStudents(Course &crs) { + string firstNames[MAX_STUDENTS]; + string lastNames[MAX_STUDENTS]; + int idNums[MAX_STUDENTS]; + + int studentNum; + + cout << "How many students are in the class? (up to " << MAX_STUDENTS + << ")\n"; + cin >> studentNum; + cin.ignore(80, '\n'); + + cout << "Enter the information about " << studentNum << " students:\n"; + for (int i = 0; i < studentNum; i++) { + cout << "First name: "; + getline(cin, firstNames[i]); + cout << "Last name: "; + getline(cin, lastNames[i]); + cout << "ID number: "; + cin >> idNums[i]; + cin.ignore(80, '\n'); + } + + crs.addStudents(studentNum, firstNames, lastNames, idNums); + + return; +} diff --git a/cs162/wk8/BUILD b/cs162/wk8/BUILD new file mode 100644 index 0000000..a2e6835 --- /dev/null +++ b/cs162/wk8/BUILD @@ -0,0 +1,15 @@ +cc_binary( + name = "inherit", + srcs = glob([ + "inherit/**/*.cc", + "inherit/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "inherit", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk8/CMakeLists.txt b/cs162/wk8/CMakeLists.txt new file mode 100644 index 0000000..fe529a4 --- /dev/null +++ b/cs162/wk8/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(inherit) diff --git a/cs162/wk8/inherit/CMakeLists.txt b/cs162/wk8/inherit/CMakeLists.txt new file mode 100644 index 0000000..7df8cdc --- /dev/null +++ b/cs162/wk8/inherit/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.21) +project(wk8_inherit) + +add_executable( + wk8_inherit + employee.cc + hourlyEmployee.cc + salesperson.cc + testEmployeeADTs.cc +) \ No newline at end of file diff --git a/cs162/wk8/inherit/employee.cc b/cs162/wk8/inherit/employee.cc new file mode 100644 index 0000000..3d72686 --- /dev/null +++ b/cs162/wk8/inherit/employee.cc @@ -0,0 +1,25 @@ +#include + +#include "employee.hh" + +int Employee::getIDNo() const { return this->idNo; } + +std::string Employee::getFName() { return this->fName; } + +std::string Employee::getLName() { return this->lName; } + +std::string Employee::getPosition() { return this->position; } + +int Employee::getDeptNo() const { return deptno; } + +void Employee::setIDNo(int _idNo) { this->idNo = _idNo; } + +void Employee::setFName(std::string _fName) { this->fName = std::move(_fName); } + +void Employee::setLName(std::string _lName) { this->lName = std::move(_lName); } + +void Employee::setPos(std::string _position) { + this->position = std::move(_position); +} + +void Employee::setDeptNo(int _deptNo) { this->deptno = _deptNo; } diff --git a/cs162/wk8/inherit/employee.hh b/cs162/wk8/inherit/employee.hh new file mode 100644 index 0000000..df4067f --- /dev/null +++ b/cs162/wk8/inherit/employee.hh @@ -0,0 +1,49 @@ +#ifndef EMPLOYEE_HH +#define EMPLOYEE_HH + +#include +#include + +class Employee { +private: + // Members + /// employee ID number + int idNo; + /// first name + std::string fName; + /// last name + std::string lName; + /// position title + std::string position; + /// department number + int deptno; + +public: + // Constructor + explicit Employee(int _idNo = 0, std::string _fName = "", + std::string _lName = "", std::string _position = "", + int _deptno = 0) + : idNo(_idNo), fName(std::move(_fName)), lName(std::move(_lName)), + position(std::move(_position)), deptno(_deptno) {} + + // Getters + /// returns ID number + [[nodiscard]] int getIDNo() const; + /// returns first name + std::string getFName(); + /// returns last name + std::string getLName(); + /// returns position title + std::string getPosition(); + /// returns department # + [[nodiscard]] int getDeptNo() const; + + // Setters + void setIDNo(int); + void setFName(std::string); + void setLName(std::string); + void setPos(std::string); + void setDeptNo(int); +}; + +#endif // EMPLOYEE_HH diff --git a/cs162/wk8/inherit/hourlyEmployee.cc b/cs162/wk8/inherit/hourlyEmployee.cc new file mode 100644 index 0000000..f89bcc8 --- /dev/null +++ b/cs162/wk8/inherit/hourlyEmployee.cc @@ -0,0 +1,7 @@ +#include "hourlyEmployee.hh" + +float HourlyEmployee::getHourlyRate() const { return this->hourlyRate; } + +void HourlyEmployee::setHourlyRate(float _hourlyRate) { + this->hourlyRate = _hourlyRate; +} diff --git a/cs162/wk8/inherit/hourlyEmployee.hh b/cs162/wk8/inherit/hourlyEmployee.hh new file mode 100644 index 0000000..f555b2a --- /dev/null +++ b/cs162/wk8/inherit/hourlyEmployee.hh @@ -0,0 +1,31 @@ +#ifndef HOURLY_EMPLOYEE_HH +#define HOURLY_EMPLOYEE_HH + +#include + +#include "employee.hh" + +class HourlyEmployee : public Employee { +private: + // Member + /// hourly rate of pay + float hourlyRate; + +public: + // Constructor + explicit HourlyEmployee(float _hourlyRate = 0, int _idNo = 0, + std::string _fName = "", std::string _lName = "", + std::string _position = "", int _deptno = 0) + : hourlyRate(_hourlyRate), + Employee(_idNo, std::move(_fName), std::move(_lName), + std::move(_position), _deptno) {} + + // Getter + /// returns hourly rate + [[nodiscard]] float getHourlyRate() const; + + // Setter + void setHourlyRate(float); +}; + +#endif // HOURLY_EMPLOYEE_HH diff --git a/cs162/wk8/inherit/salesperson.cc b/cs162/wk8/inherit/salesperson.cc new file mode 100644 index 0000000..a4d484a --- /dev/null +++ b/cs162/wk8/inherit/salesperson.cc @@ -0,0 +1,11 @@ +#include "salesperson.hh" + +float Salesperson::getFlatIncome() const { return this->flatIncome; } + +float Salesperson::getCommRate() const { return this->commRate; } + +void Salesperson::setFlatIncome(float _flatIncome) { + this->flatIncome = _flatIncome; +} + +void Salesperson::setCommRate(float _commRate) { this->commRate = _commRate; } diff --git a/cs162/wk8/inherit/salesperson.hh b/cs162/wk8/inherit/salesperson.hh new file mode 100644 index 0000000..4a9c358 --- /dev/null +++ b/cs162/wk8/inherit/salesperson.hh @@ -0,0 +1,35 @@ +#ifndef SALESPERSON_HH +#define SALESPERSON_HH + +#include "employee.hh" + +class Salesperson : public Employee { +private: + // Members + /// monthly flat income + float flatIncome; + /// commission rate + float commRate; + +public: + // Constructor + explicit Salesperson(float _flatIncome = 0, float _commRate = 0, + int _idNo = 0, std::string _fName = "", + std::string _lName = "", std::string _position = "", + int _deptno = 0) + : flatIncome(_flatIncome), commRate(_commRate), + Employee(_idNo, std::move(_fName), std::move(_lName), + std::move(_position), _deptno) {} + + // Getters + /// returns flat income + [[nodiscard]] float getFlatIncome() const; + /// returns commission rate + [[nodiscard]] float getCommRate() const; + + // Setters + void setFlatIncome(float); + void setCommRate(float); +}; + +#endif // SALESPERSON_HH diff --git a/cs162/wk8/inherit/testEmployeeADTs.cc b/cs162/wk8/inherit/testEmployeeADTs.cc new file mode 100644 index 0000000..8500b5b --- /dev/null +++ b/cs162/wk8/inherit/testEmployeeADTs.cc @@ -0,0 +1,214 @@ +#include +#include + +#include "employee.hh" +#include "hourlyEmployee.hh" +#include "salesperson.hh" + +#define INIT_TESTS() \ + int __test_tested = 0; \ + int __test_passed = 0; \ + auto __test_clock = std::chrono::high_resolution_clock::now(); + +#define TESTS_TESTED __test_tested +#define TESTS_PASSED __test_passed +#define TEST_TIME \ + std::chrono::duration_cast( \ + std::chrono::high_resolution_clock::now() - __test_clock) \ + .count() + +#define TEST(context, from, field, value) \ + { \ + if (test(context, from, field, value)) { \ + __test_passed += 1; \ + } \ + __test_tested += 1; \ + } + +template +bool test(const std::string &, C, K, V); + +int main() { + INIT_TESTS() + + // Test everything on `Employee` using a full constructor + { + Employee employee(1, "2", "3", "4", 5); + + TEST(".getIDNo()", employee, employee.getIDNo(), 1) + TEST(".getFName()", employee, employee.getFName(), "2") + TEST(".getLName()", employee, employee.getLName(), "3") + TEST(".getPosition()", employee, employee.getPosition(), "4") + TEST(".getDeptNo()", employee, employee.getDeptNo(), 5) + + employee.setIDNo(6); + employee.setFName("7"); + employee.setLName("8"); + employee.setPos("9"); + employee.setDeptNo(10); + + TEST(".setIDNo()", employee, employee.getIDNo(), 6) + TEST(".setFName()", employee, employee.getFName(), "7") + TEST(".setLName()", employee, employee.getLName(), "8") + TEST(".setPos()", employee, employee.getPosition(), "9") + TEST(".setDeptNo()", employee, employee.getDeptNo(), 10) + } + + // Test everything on `Employee` using an empty constructor + { + Employee employee; + + TEST(".getIDNo()", employee, employee.getIDNo(), 0) + TEST(".getFName()", employee, employee.getFName(), "") + TEST(".getLName()", employee, employee.getLName(), "") + TEST(".getPosition()", employee, employee.getPosition(), "") + TEST(".getDeptNo()", employee, employee.getDeptNo(), 0) + + employee.setIDNo(6); + employee.setFName("7"); + employee.setLName("8"); + employee.setPos("9"); + employee.setDeptNo(10); + + TEST(".setIDNo()", employee, employee.getIDNo(), 6) + TEST(".setFName()", employee, employee.getFName(), "7") + TEST(".setLName()", employee, employee.getLName(), "8") + TEST(".setPos()", employee, employee.getPosition(), "9") + TEST(".setDeptNo()", employee, employee.getDeptNo(), 10) + } + + // Test everything on `HourlyEmployee` using a full constructor + { + HourlyEmployee employee(0, 1, "2", "3", "4", 5); + + TEST(".getHourlyRate()", employee, employee.getHourlyRate(), 0) + TEST(".getIDNo()", employee, employee.getIDNo(), 1) + TEST(".getFName()", employee, employee.getFName(), "2") + TEST(".getLName()", employee, employee.getLName(), "3") + TEST(".getPosition()", employee, employee.getPosition(), "4") + TEST(".getDeptNo()", employee, employee.getDeptNo(), 5) + + employee.setIDNo(6); + employee.setFName("7"); + employee.setLName("8"); + employee.setPos("9"); + employee.setDeptNo(10); + employee.setHourlyRate(11); + + TEST(".setIDNo()", employee, employee.getIDNo(), 6) + TEST(".setFName()", employee, employee.getFName(), "7") + TEST(".setLName()", employee, employee.getLName(), "8") + TEST(".setPos()", employee, employee.getPosition(), "9") + TEST(".setDeptNo()", employee, employee.getDeptNo(), 10) + TEST(".setHourlyRate()", employee, employee.getHourlyRate(), 11) + } + + // Test everything on `HourlyEmployee` using an empty constructor + { + HourlyEmployee employee; + + TEST(".getHourlyRate()", employee, employee.getHourlyRate(), 0) + TEST(".getIDNo()", employee, employee.getIDNo(), 0) + TEST(".getFName()", employee, employee.getFName(), "") + TEST(".getLName()", employee, employee.getLName(), "") + TEST(".getPosition()", employee, employee.getPosition(), "") + TEST(".getDeptNo()", employee, employee.getDeptNo(), 0) + + employee.setIDNo(6); + employee.setFName("7"); + employee.setLName("8"); + employee.setPos("9"); + employee.setDeptNo(10); + employee.setHourlyRate(11); + + TEST(".setIDNo()", employee, employee.getIDNo(), 6) + TEST(".setFName()", employee, employee.getFName(), "7") + TEST(".setLName()", employee, employee.getLName(), "8") + TEST(".setPos()", employee, employee.getPosition(), "9") + TEST(".setDeptNo()", employee, employee.getDeptNo(), 10) + TEST(".setHourlyRate()", employee, employee.getHourlyRate(), 11) + } + + // Test everything on `Salesperson` using a full constructor + { + Salesperson employee(-1, 0, 1, "2", "3", "4", 5); + + TEST(".getFlatIncome()", employee, employee.getFlatIncome(), -1) + TEST(".getCommRate()", employee, employee.getCommRate(), 0) + TEST(".getIDNo()", employee, employee.getIDNo(), 1) + TEST(".getFName()", employee, employee.getFName(), "2") + TEST(".getLName()", employee, employee.getLName(), "3") + TEST(".getPosition()", employee, employee.getPosition(), "4") + TEST(".getDeptNo()", employee, employee.getDeptNo(), 5) + + employee.setIDNo(6); + employee.setFName("7"); + employee.setLName("8"); + employee.setPos("9"); + employee.setDeptNo(10); + employee.setFlatIncome(11); + employee.setCommRate(12); + + TEST(".setIDNo()", employee, employee.getIDNo(), 6) + TEST(".setFName()", employee, employee.getFName(), "7") + TEST(".setLName()", employee, employee.getLName(), "8") + TEST(".setPos()", employee, employee.getPosition(), "9") + TEST(".setDeptNo()", employee, employee.getDeptNo(), 10) + TEST(".setFlatIncome()", employee, employee.getFlatIncome(), 11) + TEST(".setCommRate()", employee, employee.getCommRate(), 12) + } + + // Test everything on `Salesperson` using an empty constructor + { + Salesperson employee; + + TEST(".getFlatIncome()", employee, employee.getFlatIncome(), 0) + TEST(".getCommRate()", employee, employee.getCommRate(), 0) + TEST(".getIDNo()", employee, employee.getIDNo(), 0) + TEST(".getFName()", employee, employee.getFName(), "") + TEST(".getLName()", employee, employee.getLName(), "") + TEST(".getPosition()", employee, employee.getPosition(), "") + TEST(".getDeptNo()", employee, employee.getDeptNo(), 0) + + employee.setIDNo(6); + employee.setFName("7"); + employee.setLName("8"); + employee.setPos("9"); + employee.setDeptNo(10); + employee.setFlatIncome(11); + employee.setCommRate(12); + + TEST(".setIDNo()", employee, employee.getIDNo(), 6) + TEST(".setFName()", employee, employee.getFName(), "7") + TEST(".setLName()", employee, employee.getLName(), "8") + TEST(".setPos()", employee, employee.getPosition(), "9") + TEST(".setDeptNo()", employee, employee.getDeptNo(), 10) + TEST(".setFlatIncome()", employee, employee.getFlatIncome(), 11) + TEST(".setCommRate()", employee, employee.getCommRate(), 12) + } + + TEST(": this **should** fail to prove that the test harness works", + Employee(), true, false) + + std::cout << "! results: performed " << TESTS_TESTED << " tests in " + << TEST_TIME << "ms with " << TESTS_PASSED << " passing and " + << TESTS_TESTED - TESTS_PASSED << " failing" << std::endl; + + return 0; +} + +// I didn't want to overcomplicate things and mess with function pointers in +// maps, symbol resolution, etc. to get the name of a function from its +// function pointer, so I just pass it as the context. :) +template +bool test(const std::string &context, C _from, K field, V expected) { + bool passed = field == expected; + + std::cout << "| " << std::string(typeid(_from).name()).substr(6) << context + << ": "; + + std::cout << (passed ? "pass" : "fail") << ": expected " << expected + << ", got " << field << std::endl; + + return passed; +} diff --git a/cs162/wk9/BUILD b/cs162/wk9/BUILD new file mode 100644 index 0000000..4bb86d3 --- /dev/null +++ b/cs162/wk9/BUILD @@ -0,0 +1,15 @@ +cc_binary( + name = "vectors", + srcs = glob([ + "vectors/**/*.cc", + "vectors/**/*.hh", + ]), +) + +filegroup( + name = "build_all", + srcs = [ + "vectors", + ], + visibility = ["//visibility:public"], +) diff --git a/cs162/wk9/CMakeLists.txt b/cs162/wk9/CMakeLists.txt new file mode 100644 index 0000000..9c5fae2 --- /dev/null +++ b/cs162/wk9/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(vectors) diff --git a/cs162/wk9/vectors/CMakeLists.txt b/cs162/wk9/vectors/CMakeLists.txt new file mode 100644 index 0000000..d476693 --- /dev/null +++ b/cs162/wk9/vectors/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.21) +project(wk9_vectors) + +add_executable( + wk9_vectors + vectors.cc +) \ No newline at end of file diff --git a/cs162/wk9/vectors/vectors.cc b/cs162/wk9/vectors/vectors.cc new file mode 100644 index 0000000..8aad0fe --- /dev/null +++ b/cs162/wk9/vectors/vectors.cc @@ -0,0 +1,172 @@ +#include +#include +#include +#include + +#define DEBUG +#define FINITE + +/** + * @brief vector related operations and types + * @see std::vector + */ +namespace vectors { + +/** + * @brief A generic "real" number type + * @see double + */ +typedef double real_type; + +/** + * @brief Get the largest value of a vector. + * @return real_type + * @see real_type + * @see std::vector + */ +real_type largest_vector_value(const std::vector &); +/** + * @brief Get the smallest value of a vector. + * @return real_type + * @see real_type + * @see std::vector + */ +real_type smallest_vector_value(const std::vector &); +/** + * @brief Get the average value of a vector. + * @return real_type + * @see real_type + * @see std::vector + */ +real_type average_vector_value(const std::vector &); + +} // namespace vectors + +int main() { + // Settings and RNG-related producers and criteria + int user_choice; + int value_precision = 2; + vectors::real_type minimum_value = 0; + vectors::real_type maximum_value = 1000; + std::size_t random_values_size; + const std::string &rt = typeid(vectors::real_type).name(); + const std::string &st = typeid(std::size_t).name(); + std::vector random_values; + std::random_device random_device; + std::default_random_engine random_engine{random_device()}; + + // Get the users input for settings and RNG criteria +#ifdef FINITE + std::cout << "minimum random value(" + rt + "): "; + std::cin >> minimum_value; + std::cout << "maximum random value(" + rt + "): "; + std::cin >> maximum_value; +#endif + std::cout << "number of initial random values(" + st + "): "; + std::cin >> random_values_size; +#ifdef FINITE + std::cout << "value precision(" + st + "): "; + std::cin >> value_precision; +#endif + // Set the precision of random number output based on the users choice. + std::cout << std::fixed << std::setprecision(value_precision); + + // Set up the RNG producer based on the user's criteria + std::uniform_real_distribution uniform_distribution{ + minimum_value, maximum_value}; + + // Append the user's preference of maximum random values to the random value + // pool + for (std::size_t i = 0; i < random_values_size; ++i) { + random_values.push_back(uniform_distribution(random_engine)); + } + + std::cout << "what operation would you like to perform?\n" + " 1. find the largest value\n" + " 2. find the smallest value\n" + " 3. compute the average value\n" + " 4. emplace more random values into the value pool\n" +#ifdef DEBUG + " 5. number of random values in the value pool\n" +#endif + " 0. quit" + << std::endl; + + // Keep performing until the user would like + do { + // Get the user's operation choice + std::cout << "your choice(" + std::string(typeid(int).name()) + "): "; + std::cin >> user_choice; + + // Perform the user's operation choice + switch (user_choice) { + case 0: { + // Say "goodbye." and free up any used resources. + std::cout << "goodbye." << std::endl; + + return 0; + } // break; + case 1: { + // Output the largest value of the vector and run again. + std::cout << "largest value: " + << vectors::largest_vector_value(random_values) << std::endl; + } break; + case 2: { + // Output the smallest value of the vector and run again. + std::cout << "smallest value: " + << vectors::smallest_vector_value(random_values) << std::endl; + } break; + case 3: { + // Output the average value of the vector and run again. + std::cout << "average value: " + << vectors::average_vector_value(random_values) << std::endl; + } break; + case 4: { + std::size_t append_maximum_random_values; + + // Get the number of random values to append to the random value pool from + // the user. + std::cout + << "number of random values to append to the random value pool: "; + std::cin >> append_maximum_random_values; + + // Append the user's choice of extra random values to the random value + // pool + for (std::size_t i = 0; i < append_maximum_random_values; ++i) { + random_values.push_back(uniform_distribution(random_engine)); + } + } break; +#ifdef DEBUG + case 5: { + // Output the number of values in the random value pool and run again. + std::cout << "number of values in the random value pool: " + << random_values.size() << std::endl; + } break; +#endif + default: { + // Inform the user the operation is invalid and run gain. + std::cout << "you chose an invalid choice. please choice a valid choice " + "the next time around." + << std::endl; + } break; + } + } while (user_choice != 0); + + return 0; +} + +namespace vectors { + +real_type largest_vector_value(const std::vector &v) { + return *std::max_element(v.begin(), v.end()); +} + +real_type smallest_vector_value(const std::vector &v) { + return *std::min_element(v.begin(), v.end()); +} + +real_type average_vector_value(const std::vector &v) { + return std::reduce(v.begin(), v.end()) / v.size(); +} + +} // namespace vectors diff --git a/data/BUILD b/data/BUILD new file mode 100644 index 0000000..fc2f8aa --- /dev/null +++ b/data/BUILD @@ -0,0 +1 @@ +exports_files(glob(["*.txt"])) diff --git a/data/dataFile.txt b/data/dataFile.txt new file mode 100644 index 0000000..6a563d2 --- /dev/null +++ b/data/dataFile.txt @@ -0,0 +1 @@ +41 67 34 0 69 24 78 58 62 64 5 45 81 27 61 91 95 42 27 36 91 4 2 53 92 82 21 16 18 95 47 26 71 38 69 12 67 99 35 94 3 11 22 33 73 64 41 11 53 68 47 44 62 57 37 59 23 41 29 78 16 35 90 42 88 6 40 42 64 48 46 5 90 29 70 50 6 1 93 48 29 23 84 54 56 40 66 76 31 8 44 39 26 23 37 38 18 82 29 41 33 15 39 58 4 30 77 6 73 86 21 45 24 72 70 29 77 73 97 12 86 90 61 36 55 67 55 74 31 52 50 50 41 24 66 30 7 91 7 37 57 87 53 83 45 9 9 \ No newline at end of file diff --git a/data/nums.txt b/data/nums.txt new file mode 100644 index 0000000..ab83a44 --- /dev/null +++ b/data/nums.txt @@ -0,0 +1,9 @@ +john adam +835 hi +50 +g g +w +2 2 3 +hi +hi +hi \ No newline at end of file diff --git a/data/words.txt b/data/words.txt new file mode 100644 index 0000000..53c8d9c --- /dev/null +++ b/data/words.txt @@ -0,0 +1,10000 @@ +a +aa +aaa +aaron +ab +abandoned +abc +aberdeen +abilities +ability +able +aboriginal +abortion +about +above +abraham +abroad +abs +absence +absent +absolute +absolutely +absorption +abstract +abstracts +abu +abuse +ac +academic +academics +academy +acc +accent +accept +acceptable +acceptance +accepted +accepting +accepts +access +accessed +accessibility +accessible +accessing +accessories +accessory +accident +accidents +accommodate +accommodation +accommodations +accompanied +accompanying +accomplish +accomplished +accordance +according +accordingly +account +accountability +accounting +accounts +accreditation +accredited +accuracy +accurate +accurately +accused +acdbentity +ace +acer +achieve +achieved +achievement +achievements +achieving +acid +acids +acknowledge +acknowledged +acm +acne +acoustic +acquire +acquired +acquisition +acquisitions +acre +acres +acrobat +across +acrylic +act +acting +action +actions +activated +activation +active +actively +activists +activities +activity +actor +actors +actress +acts +actual +actually +acute +ad +ada +adam +adams +adaptation +adapted +adapter +adapters +adaptive +adaptor +add +added +addiction +adding +addition +additional +additionally +additions +address +addressed +addresses +addressing +adds +adelaide +adequate +adidas +adipex +adjacent +adjust +adjustable +adjusted +adjustment +adjustments +admin +administered +administration +administrative +administrator +administrators +admission +admissions +admit +admitted +adobe +adolescent +adopt +adopted +adoption +adrian +ads +adsl +adult +adults +advance +advanced +advancement +advances +advantage +advantages +adventure +adventures +adverse +advert +advertise +advertisement +advertisements +advertiser +advertisers +advertising +advice +advise +advised +advisor +advisors +advisory +advocacy +advocate +adware +ae +aerial +aerospace +af +affair +affairs +affect +affected +affecting +affects +affiliate +affiliated +affiliates +affiliation +afford +affordable +afghanistan +afraid +africa +african +after +afternoon +afterwards +ag +again +against +age +aged +agencies +agency +agenda +agent +agents +ages +aggregate +aggressive +aging +ago +agree +agreed +agreement +agreements +agrees +agricultural +agriculture +ah +ahead +ai +aid +aids +aim +aimed +aims +air +aircraft +airfare +airline +airlines +airplane +airport +airports +aj +ak +aka +al +ala +alabama +alan +alarm +alaska +albania +albany +albert +alberta +album +albums +albuquerque +alcohol +alert +alerts +alex +alexander +alexandria +alfred +algebra +algeria +algorithm +algorithms +ali +alias +alice +alien +align +alignment +alike +alive +all +allah +allan +alleged +allen +allergy +alliance +allied +allocated +allocation +allow +allowance +allowed +allowing +allows +alloy +almost +alone +along +alot +alpha +alphabetical +alpine +already +also +alt +alter +altered +alternate +alternative +alternatively +alternatives +although +alto +aluminium +aluminum +alumni +always +am +amanda +amateur +amazing +amazon +amazoncom +amazoncouk +ambassador +amber +ambien +ambient +amd +amend +amended +amendment +amendments +amenities +america +american +americans +americas +amino +among +amongst +amount +amounts +amp +ampland +amplifier +amsterdam +amy +an +ana +anaheim +anal +analog +analyses +analysis +analyst +analysts +analytical +analyze +analyzed +anatomy +anchor +ancient +and +andale +anderson +andorra +andrea +andreas +andrew +andrews +andy +angel +angela +angeles +angels +anger +angle +angola +angry +animal +animals +animated +animation +anime +ann +anna +anne +annex +annie +anniversary +annotated +annotation +announce +announced +announcement +announcements +announces +annoying +annual +annually +anonymous +another +answer +answered +answering +answers +ant +antarctica +antenna +anthony +anthropology +anti +antibodies +antibody +anticipated +antigua +antique +antiques +antivirus +antonio +anxiety +any +anybody +anymore +anyone +anything +anytime +anyway +anywhere +aol +ap +apache +apart +apartment +apartments +api +apnic +apollo +app +apparatus +apparel +apparent +apparently +appeal +appeals +appear +appearance +appeared +appearing +appears +appendix +apple +appliance +appliances +applicable +applicant +applicants +application +applications +applied +applies +apply +applying +appointed +appointment +appointments +appraisal +appreciate +appreciated +appreciation +approach +approaches +appropriate +appropriations +approval +approve +approved +approx +approximate +approximately +apps +apr +april +apt +aqua +aquarium +aquatic +ar +arab +arabia +arabic +arbitrary +arbitration +arc +arcade +arch +architect +architects +architectural +architecture +archive +archived +archives +arctic +are +area +areas +arena +arg +argentina +argue +argued +argument +arguments +arise +arising +arizona +arkansas +arlington +arm +armed +armenia +armor +arms +armstrong +army +arnold +around +arrange +arranged +arrangement +arrangements +array +arrest +arrested +arrival +arrivals +arrive +arrived +arrives +arrow +art +arthritis +arthur +article +articles +artificial +artist +artistic +artists +arts +artwork +aruba +as +asbestos +ascii +ash +ashley +asia +asian +aside +asin +ask +asked +asking +asks +asn +asp +aspect +aspects +aspnet +ass +assault +assembled +assembly +assess +assessed +assessing +assessment +assessments +asset +assets +assign +assigned +assignment +assignments +assist +assistance +assistant +assisted +assists +associate +associated +associates +association +associations +assume +assumed +assumes +assuming +assumption +assumptions +assurance +assure +assured +asthma +astrology +astronomy +asus +at +ata +ate +athens +athletes +athletic +athletics +ati +atlanta +atlantic +atlas +atm +atmosphere +atmospheric +atom +atomic +attach +attached +attachment +attachments +attack +attacked +attacks +attempt +attempted +attempting +attempts +attend +attendance +attended +attending +attention +attitude +attitudes +attorney +attorneys +attract +attraction +attractions +attractive +attribute +attributes +au +auburn +auckland +auction +auctions +aud +audi +audience +audio +audit +auditor +aug +august +aurora +aus +austin +australia +australian +austria +authentic +authentication +author +authorities +authority +authorization +authorized +authors +auto +automated +automatic +automatically +automation +automobile +automobiles +automotive +autos +autumn +av +availability +available +avatar +ave +avenue +average +avg +avi +aviation +avoid +avoiding +avon +aw +award +awarded +awards +aware +awareness +away +awesome +awful +axis +aye +az +azerbaijan +b +ba +babe +babes +babies +baby +bachelor +back +backed +background +backgrounds +backing +backup +bacon +bacteria +bacterial +bad +badge +badly +bag +baghdad +bags +bahamas +bahrain +bailey +baker +baking +balance +balanced +bald +bali +ball +ballet +balloon +ballot +balls +baltimore +ban +banana +band +bands +bandwidth +bang +bangbus +bangkok +bangladesh +bank +banking +bankruptcy +banks +banned +banner +banners +baptist +bar +barbados +barbara +barbie +barcelona +bare +barely +bargain +bargains +barn +barnes +barrel +barrier +barriers +barry +bars +base +baseball +based +baseline +basement +basename +bases +basic +basically +basics +basin +basis +basket +basketball +baskets +bass +bat +batch +bath +bathroom +bathrooms +baths +batman +batteries +battery +battle +battlefield +bay +bb +bbc +bbs +bbw +bc +bd +bdsm +be +beach +beaches +beads +beam +bean +beans +bear +bearing +bears +beast +beastality +beastiality +beat +beatles +beats +beautiful +beautifully +beauty +beaver +became +because +become +becomes +becoming +bed +bedding +bedford +bedroom +bedrooms +beds +bee +beef +been +beer +before +began +begin +beginner +beginners +beginning +begins +begun +behalf +behavior +behavioral +behaviour +behind +beijing +being +beings +belarus +belfast +belgium +belief +beliefs +believe +believed +believes +belize +belkin +bell +belle +belly +belong +belongs +below +belt +belts +ben +bench +benchmark +bend +beneath +beneficial +benefit +benefits +benjamin +bennett +benz +berkeley +berlin +bermuda +bernard +berry +beside +besides +best +bestiality +bestsellers +bet +beta +beth +better +betting +betty +between +beverage +beverages +beverly +beyond +bg +bhutan +bi +bias +bible +biblical +bibliographic +bibliography +bicycle +bid +bidder +bidding +bids +big +bigger +biggest +bike +bikes +bikini +bill +billing +billion +bills +billy +bin +binary +bind +binding +bingo +bio +biodiversity +biographies +biography +biol +biological +biology +bios +biotechnology +bird +birds +birmingham +birth +birthday +bishop +bit +bitch +bite +bits +biz +bizarre +bizrate +bk +bl +black +blackberry +blackjack +blacks +blade +blades +blah +blair +blake +blame +blank +blanket +blast +bleeding +blend +bless +blessed +blind +blink +block +blocked +blocking +blocks +blog +blogger +bloggers +blogging +blogs +blond +blonde +blood +bloody +bloom +bloomberg +blow +blowing +blowjob +blowjobs +blue +blues +bluetooth +blvd +bm +bmw +bo +board +boards +boat +boating +boats +bob +bobby +boc +bodies +body +bold +bolivia +bolt +bomb +bon +bond +bondage +bonds +bone +bones +bonus +boob +boobs +book +booking +bookings +bookmark +bookmarks +books +bookstore +bool +boolean +boom +boost +boot +booth +boots +booty +border +borders +bored +boring +born +borough +bosnia +boss +boston +both +bother +botswana +bottle +bottles +bottom +bought +boulder +boulevard +bound +boundaries +boundary +bouquet +boutique +bow +bowl +bowling +box +boxed +boxes +boxing +boy +boys +bp +br +bra +bracelet +bracelets +bracket +brad +bradford +bradley +brain +brake +brakes +branch +branches +brand +brandon +brands +bras +brass +brave +brazil +brazilian +breach +bread +break +breakdown +breakfast +breaking +breaks +breast +breasts +breath +breathing +breed +breeding +breeds +brian +brick +bridal +bride +bridge +bridges +brief +briefing +briefly +briefs +bright +brighton +brilliant +bring +bringing +brings +brisbane +bristol +britain +britannica +british +britney +broad +broadband +broadcast +broadcasting +broader +broadway +brochure +brochures +broke +broken +broker +brokers +bronze +brook +brooklyn +brooks +bros +brother +brothers +brought +brown +browse +browser +browsers +browsing +bruce +brunei +brunette +brunswick +brush +brussels +brutal +bryan +bryant +bs +bt +bubble +buck +bucks +budapest +buddy +budget +budgets +buf +buffalo +buffer +bufing +bug +bugs +build +builder +builders +building +buildings +builds +built +bukkake +bulgaria +bulgarian +bulk +bull +bullet +bulletin +bumper +bunch +bundle +bunny +burden +bureau +buried +burke +burlington +burn +burner +burning +burns +burst +burton +bus +buses +bush +business +businesses +busty +busy +but +butler +butt +butter +butterfly +button +buttons +butts +buy +buyer +buyers +buying +buys +buzz +bw +by +bye +byte +bytes +c +ca +cab +cabin +cabinet +cabinets +cable +cables +cache +cached +cad +cadillac +cafe +cage +cake +cakes +cal +calcium +calculate +calculated +calculation +calculations +calculator +calculators +calendar +calendars +calgary +calibration +calif +california +call +called +calling +calls +calm +calvin +cam +cambodia +cambridge +camcorder +camcorders +came +camel +camera +cameras +cameron +cameroon +camp +campaign +campaigns +campbell +camping +camps +campus +cams +can +canada +canadian +canal +canberra +cancel +cancellation +cancelled +cancer +candidate +candidates +candle +candles +candy +cannon +canon +cant +canvas +canyon +cap +capabilities +capability +capable +capacity +cape +capital +capitol +caps +captain +capture +captured +car +carb +carbon +card +cardiac +cardiff +cardiovascular +cards +care +career +careers +careful +carefully +carey +cargo +caribbean +caring +carl +carlo +carlos +carmen +carnival +carol +carolina +caroline +carpet +carried +carrier +carriers +carries +carroll +carry +carrying +cars +cart +carter +cartoon +cartoons +cartridge +cartridges +cas +casa +case +cases +casey +cash +cashiers +casino +casinos +casio +cassette +cast +casting +castle +casual +cat +catalog +catalogs +catalogue +catalyst +catch +categories +category +catering +cathedral +catherine +catholic +cats +cattle +caught +cause +caused +causes +causing +caution +cave +cayman +cb +cbs +cc +ccd +cd +cdna +cds +cdt +ce +cedar +ceiling +celebrate +celebration +celebrities +celebrity +celebs +cell +cells +cellular +celtic +cement +cemetery +census +cent +center +centered +centers +central +centre +centres +cents +centuries +century +ceo +ceramic +ceremony +certain +certainly +certificate +certificates +certification +certified +cest +cet +cf +cfr +cg +cgi +ch +chad +chain +chains +chair +chairman +chairs +challenge +challenged +challenges +challenging +chamber +chambers +champagne +champion +champions +championship +championships +chan +chance +chancellor +chances +change +changed +changelog +changes +changing +channel +channels +chaos +chapel +chapter +chapters +char +character +characteristic +characteristics +characterization +characterized +characters +charge +charged +charger +chargers +charges +charging +charitable +charity +charles +charleston +charlie +charlotte +charm +charming +charms +chart +charter +charts +chase +chassis +chat +cheap +cheaper +cheapest +cheat +cheats +check +checked +checking +checklist +checkout +checks +cheers +cheese +chef +chelsea +chem +chemical +chemicals +chemistry +chen +cheque +cherry +chess +chest +chester +chevrolet +chevy +chi +chicago +chick +chicken +chicks +chief +child +childhood +children +childrens +chile +china +chinese +chip +chips +cho +chocolate +choice +choices +choir +cholesterol +choose +choosing +chorus +chose +chosen +chris +christ +christian +christianity +christians +christina +christine +christmas +christopher +chrome +chronic +chronicle +chronicles +chrysler +chubby +chuck +church +churches +ci +cia +cialis +ciao +cigarette +cigarettes +cincinnati +cindy +cinema +cingular +cio +cir +circle +circles +circuit +circuits +circular +circulation +circumstances +circus +cisco +citation +citations +cite +cited +cities +citizen +citizens +citizenship +city +citysearch +civic +civil +civilian +civilization +cj +cl +claim +claimed +claims +claire +clan +clara +clarity +clark +clarke +class +classes +classic +classical +classics +classification +classified +classifieds +classroom +clause +clay +clean +cleaner +cleaners +cleaning +cleanup +clear +clearance +cleared +clearing +clearly +clerk +cleveland +click +clicking +clicks +client +clients +cliff +climate +climb +climbing +clinic +clinical +clinics +clinton +clip +clips +clock +clocks +clone +close +closed +closely +closer +closes +closest +closing +closure +cloth +clothes +clothing +cloud +clouds +cloudy +club +clubs +cluster +clusters +cm +cms +cn +cnet +cnetcom +cnn +co +coach +coaches +coaching +coal +coalition +coast +coastal +coat +coated +coating +cock +cocks +cod +code +codes +coding +coffee +cognitive +cohen +coin +coins +col +cold +cole +coleman +colin +collaboration +collaborative +collapse +collar +colleague +colleagues +collect +collectables +collected +collectible +collectibles +collecting +collection +collections +collective +collector +collectors +college +colleges +collins +cologne +colombia +colon +colonial +colony +color +colorado +colored +colors +colour +colours +columbia +columbus +column +columnists +columns +com +combat +combination +combinations +combine +combined +combines +combining +combo +come +comedy +comes +comfort +comfortable +comic +comics +coming +comm +command +commander +commands +comment +commentary +commented +comments +commerce +commercial +commission +commissioner +commissioners +commissions +commit +commitment +commitments +committed +committee +committees +commodities +commodity +common +commonly +commons +commonwealth +communicate +communication +communications +communist +communities +community +comp +compact +companies +companion +company +compaq +comparable +comparative +compare +compared +comparing +comparison +comparisons +compatibility +compatible +compensation +compete +competent +competing +competition +competitions +competitive +competitors +compilation +compile +compiled +compiler +complaint +complaints +complement +complete +completed +completely +completing +completion +complex +complexity +compliance +compliant +complicated +complications +complimentary +comply +component +components +composed +composer +composite +composition +compound +compounds +comprehensive +compressed +compression +compromise +computation +computational +compute +computed +computer +computers +computing +con +concentrate +concentration +concentrations +concept +concepts +conceptual +concern +concerned +concerning +concerns +concert +concerts +conclude +concluded +conclusion +conclusions +concord +concrete +condition +conditional +conditioning +conditions +condo +condos +conduct +conducted +conducting +conf +conference +conferences +conferencing +confidence +confident +confidential +confidentiality +config +configuration +configure +configured +configuring +confirm +confirmation +confirmed +conflict +conflicts +confused +confusion +congo +congratulations +congress +congressional +conjunction +connect +connected +connecticut +connecting +connection +connections +connectivity +connector +connectors +cons +conscious +consciousness +consecutive +consensus +consent +consequence +consequences +consequently +conservation +conservative +consider +considerable +consideration +considerations +considered +considering +considers +consist +consistency +consistent +consistently +consisting +consists +console +consoles +consolidated +consolidation +consortium +conspiracy +const +constant +constantly +constitute +constitutes +constitution +constitutional +constraint +constraints +construct +constructed +construction +consult +consultancy +consultant +consultants +consultation +consulting +consumer +consumers +consumption +contact +contacted +contacting +contacts +contain +contained +container +containers +containing +contains +contamination +contemporary +content +contents +contest +contests +context +continent +continental +continually +continue +continued +continues +continuing +continuity +continuous +continuously +contract +contracting +contractor +contractors +contracts +contrary +contrast +contribute +contributed +contributing +contribution +contributions +contributor +contributors +control +controlled +controller +controllers +controlling +controls +controversial +controversy +convenience +convenient +convention +conventional +conventions +convergence +conversation +conversations +conversion +convert +converted +converter +convertible +convicted +conviction +convinced +cook +cookbook +cooked +cookie +cookies +cooking +cool +cooler +cooling +cooper +cooperation +cooperative +coordinate +coordinated +coordinates +coordination +coordinator +cop +cope +copied +copies +copper +copy +copying +copyright +copyrighted +copyrights +coral +cord +cordless +core +cork +corn +cornell +corner +corners +cornwall +corp +corporate +corporation +corporations +corps +corpus +correct +corrected +correction +corrections +correctly +correlation +correspondence +corresponding +corruption +cos +cosmetic +cosmetics +cost +costa +costs +costume +costumes +cottage +cottages +cotton +could +council +councils +counsel +counseling +count +counted +counter +counters +counties +counting +countries +country +counts +county +couple +coupled +couples +coupon +coupons +courage +courier +course +courses +court +courtesy +courts +cove +cover +coverage +covered +covering +covers +cow +cowboy +cox +cp +cpu +cr +crack +cradle +craft +crafts +craig +crap +craps +crash +crawford +crazy +cream +create +created +creates +creating +creation +creations +creative +creativity +creator +creature +creatures +credit +credits +creek +crest +crew +cricket +crime +crimes +criminal +crisis +criteria +criterion +critical +criticism +critics +crm +croatia +crop +crops +cross +crossing +crossword +crowd +crown +crucial +crude +cruise +cruises +cruz +cry +crystal +cs +css +cst +ct +cu +cuba +cube +cubic +cuisine +cult +cultural +culture +cultures +cum +cumshot +cumshots +cumulative +cunt +cup +cups +cure +curious +currencies +currency +current +currently +curriculum +cursor +curtis +curve +curves +custody +custom +customer +customers +customise +customize +customized +customs +cut +cute +cuts +cutting +cv +cvs +cw +cyber +cycle +cycles +cycling +cylinder +cyprus +cz +czech +d +da +dad +daddy +daily +dairy +daisy +dakota +dale +dallas +dam +damage +damaged +damages +dame +damn +dan +dana +dance +dancing +danger +dangerous +daniel +danish +danny +dans +dare +dark +darkness +darwin +das +dash +dat +data +database +databases +date +dated +dates +dating +daughter +daughters +dave +david +davidson +davis +dawn +day +days +dayton +db +dc +dd +ddr +de +dead +deadline +deadly +deaf +deal +dealer +dealers +dealing +deals +dealt +dealtime +dean +dear +death +deaths +debate +debian +deborah +debt +debug +debut +dec +decade +decades +december +decent +decide +decided +decimal +decision +decisions +deck +declaration +declare +declared +decline +declined +decor +decorating +decorative +decrease +decreased +dedicated +dee +deemed +deep +deeper +deeply +deer +def +default +defeat +defects +defence +defend +defendant +defense +defensive +deferred +deficit +define +defined +defines +defining +definitely +definition +definitions +degree +degrees +del +delaware +delay +delayed +delays +delegation +delete +deleted +delhi +delicious +delight +deliver +delivered +delivering +delivers +delivery +dell +delta +deluxe +dem +demand +demanding +demands +demo +democracy +democrat +democratic +democrats +demographic +demonstrate +demonstrated +demonstrates +demonstration +den +denial +denied +denmark +dennis +dense +density +dental +dentists +denver +deny +department +departmental +departments +departure +depend +dependence +dependent +depending +depends +deployment +deposit +deposits +depot +depression +dept +depth +deputy +der +derby +derek +derived +des +descending +describe +described +describes +describing +description +descriptions +desert +deserve +design +designated +designation +designed +designer +designers +designing +designs +desirable +desire +desired +desk +desktop +desktops +desperate +despite +destination +destinations +destiny +destroy +destroyed +destruction +detail +detailed +details +detect +detected +detection +detective +detector +determination +determine +determined +determines +determining +detroit +deutsch +deutsche +deutschland +dev +devel +develop +developed +developer +developers +developing +development +developmental +developments +develops +deviant +deviation +device +devices +devil +devon +devoted +df +dg +dh +di +diabetes +diagnosis +diagnostic +diagram +dial +dialog +dialogue +diameter +diamond +diamonds +diana +diane +diary +dice +dick +dicke +dicks +dictionaries +dictionary +did +die +died +diego +dies +diesel +diet +dietary +diff +differ +difference +differences +different +differential +differently +difficult +difficulties +difficulty +diffs +dig +digest +digit +digital +dildo +dildos +dim +dimension +dimensional +dimensions +dining +dinner +dip +diploma +dir +direct +directed +direction +directions +directive +directly +director +directories +directors +directory +dirt +dirty +dis +disabilities +disability +disable +disabled +disagree +disappointed +disaster +disc +discharge +disciplinary +discipline +disciplines +disclaimer +disclaimers +disclose +disclosure +disco +discount +discounted +discounts +discover +discovered +discovery +discrete +discretion +discrimination +discs +discuss +discussed +discusses +discussing +discussion +discussions +disease +diseases +dish +dishes +disk +disks +disney +disorder +disorders +dispatch +dispatched +display +displayed +displaying +displays +disposal +disposition +dispute +disputes +dist +distance +distances +distant +distinct +distinction +distinguished +distribute +distributed +distribution +distributions +distributor +distributors +district +districts +disturbed +div +dive +diverse +diversity +divide +divided +dividend +divine +diving +division +divisions +divorce +divx +diy +dj +dk +dl +dm +dna +dns +do +doc +dock +docs +doctor +doctors +doctrine +document +documentary +documentation +documentcreatetextnode +documented +documents +dod +dodge +doe +does +dog +dogs +doing +doll +dollar +dollars +dolls +dom +domain +domains +dome +domestic +dominant +dominican +don +donald +donate +donated +donation +donations +done +donna +donor +donors +dont +doom +door +doors +dos +dosage +dose +dot +double +doubt +doug +douglas +dover +dow +down +download +downloadable +downloadcom +downloaded +downloading +downloads +downtown +dozen +dozens +dp +dpi +dr +draft +drag +dragon +drain +drainage +drama +dramatic +dramatically +draw +drawing +drawings +drawn +draws +dream +dreams +dress +dressed +dresses +dressing +drew +dried +drill +drilling +drink +drinking +drinks +drive +driven +driver +drivers +drives +driving +drop +dropped +drops +drove +drug +drugs +drum +drums +drunk +dry +dryer +ds +dsc +dsl +dt +dts +du +dual +dubai +dublin +duck +dude +due +dui +duke +dumb +dump +duncan +duo +duplicate +durable +duration +durham +during +dust +dutch +duties +duty +dv +dvd +dvds +dx +dying +dylan +dynamic +dynamics +e +ea +each +eagle +eagles +ear +earl +earlier +earliest +early +earn +earned +earning +earnings +earrings +ears +earth +earthquake +ease +easier +easily +east +easter +eastern +easy +eat +eating +eau +ebay +ebony +ebook +ebooks +ec +echo +eclipse +eco +ecological +ecology +ecommerce +economic +economics +economies +economy +ecuador +ed +eddie +eden +edgar +edge +edges +edinburgh +edit +edited +editing +edition +editions +editor +editorial +editorials +editors +edmonton +eds +edt +educated +education +educational +educators +edward +edwards +ee +ef +effect +effective +effectively +effectiveness +effects +efficiency +efficient +efficiently +effort +efforts +eg +egg +eggs +egypt +egyptian +eh +eight +either +ejaculation +el +elder +elderly +elect +elected +election +elections +electoral +electric +electrical +electricity +electro +electron +electronic +electronics +elegant +element +elementary +elements +elephant +elevation +eleven +eligibility +eligible +eliminate +elimination +elite +elizabeth +ellen +elliott +ellis +else +elsewhere +elvis +em +emacs +email +emails +embassy +embedded +emerald +emergency +emerging +emily +eminem +emirates +emission +emissions +emma +emotional +emotions +emperor +emphasis +empire +empirical +employ +employed +employee +employees +employer +employers +employment +empty +en +enable +enabled +enables +enabling +enb +enclosed +enclosure +encoding +encounter +encountered +encourage +encouraged +encourages +encouraging +encryption +encyclopedia +end +endangered +ended +endif +ending +endless +endorsed +endorsement +ends +enemies +enemy +energy +enforcement +eng +engage +engaged +engagement +engaging +engine +engineer +engineering +engineers +engines +england +english +enhance +enhanced +enhancement +enhancements +enhancing +enjoy +enjoyed +enjoying +enlarge +enlargement +enormous +enough +enquiries +enquiry +enrolled +enrollment +ensemble +ensure +ensures +ensuring +ent +enter +entered +entering +enterprise +enterprises +enters +entertaining +entertainment +entire +entirely +entities +entitled +entity +entrance +entrepreneur +entrepreneurs +entries +entry +envelope +environment +environmental +environments +enzyme +eos +ep +epa +epic +epinions +epinionscom +episode +episodes +epson +eq +equal +equality +equally +equation +equations +equilibrium +equipment +equipped +equity +equivalent +er +era +eric +ericsson +erik +erotic +erotica +erp +error +errors +es +escape +escort +escorts +especially +espn +essay +essays +essence +essential +essentially +essentials +essex +est +establish +established +establishing +establishment +estate +estates +estimate +estimated +estimates +estimation +estonia +et +etc +eternal +ethernet +ethical +ethics +ethiopia +ethnic +eu +eugene +eur +euro +europe +european +euros +ev +eva +eval +evaluate +evaluated +evaluating +evaluation +evaluations +evanescence +evans +eve +even +evening +event +events +eventually +ever +every +everybody +everyday +everyone +everything +everywhere +evidence +evident +evil +evolution +ex +exact +exactly +exam +examination +examinations +examine +examined +examines +examining +example +examples +exams +exceed +excel +excellence +excellent +except +exception +exceptional +exceptions +excerpt +excess +excessive +exchange +exchanges +excited +excitement +exciting +exclude +excluded +excluding +exclusion +exclusive +exclusively +excuse +exec +execute +executed +execution +executive +executives +exempt +exemption +exercise +exercises +exhaust +exhibit +exhibition +exhibitions +exhibits +exist +existed +existence +existing +exists +exit +exotic +exp +expand +expanded +expanding +expansion +expansys +expect +expectations +expected +expects +expedia +expenditure +expenditures +expense +expenses +expensive +experience +experienced +experiences +experiencing +experiment +experimental +experiments +expert +expertise +experts +expiration +expired +expires +explain +explained +explaining +explains +explanation +explicit +explicitly +exploration +explore +explorer +exploring +explosion +expo +export +exports +exposed +exposure +express +expressed +expression +expressions +ext +extend +extended +extending +extends +extension +extensions +extensive +extent +exterior +external +extra +extract +extraction +extraordinary +extras +extreme +extremely +eye +eyed +eyes +ez +f +fa +fabric +fabrics +fabulous +face +faced +faces +facial +facilitate +facilities +facility +facing +fact +factor +factors +factory +facts +faculty +fail +failed +failing +fails +failure +failures +fair +fairfield +fairly +fairy +faith +fake +fall +fallen +falling +falls +false +fame +familiar +families +family +famous +fan +fancy +fans +fantastic +fantasy +faq +faqs +far +fare +fares +farm +farmer +farmers +farming +farms +fascinating +fashion +fast +faster +fastest +fat +fatal +fate +father +fathers +fatty +fault +favor +favorite +favorites +favors +favour +favourite +favourites +fax +fbi +fc +fcc +fd +fda +fe +fear +fears +feat +feature +featured +features +featuring +feb +february +fed +federal +federation +fee +feed +feedback +feeding +feeds +feel +feeling +feelings +feels +fees +feet +fell +fellow +fellowship +felt +female +females +fence +feof +ferrari +ferry +festival +festivals +fetish +fever +few +fewer +ff +fg +fi +fiber +fibre +fiction +field +fields +fifteen +fifth +fifty +fig +fight +fighter +fighters +fighting +figure +figured +figures +fiji +file +filed +filename +files +filing +fill +filled +filling +film +filme +films +filter +filtering +filters +fin +final +finally +finals +finance +finances +financial +financing +find +findarticles +finder +finding +findings +findlaw +finds +fine +finest +finger +fingering +fingers +finish +finished +finishing +finite +finland +finnish +fioricet +fire +fired +firefox +fireplace +fires +firewall +firewire +firm +firms +firmware +first +fiscal +fish +fisher +fisheries +fishing +fist +fisting +fit +fitness +fits +fitted +fitting +five +fix +fixed +fixes +fixtures +fl +fla +flag +flags +flame +flash +flashers +flashing +flat +flavor +fleece +fleet +flesh +flex +flexibility +flexible +flickr +flight +flights +flip +float +floating +flood +floor +flooring +floors +floppy +floral +florence +florida +florist +florists +flour +flow +flower +flowers +flows +floyd +flu +fluid +flush +flux +fly +flyer +flying +fm +fo +foam +focal +focus +focused +focuses +focusing +fog +fold +folder +folders +folding +folk +folks +follow +followed +following +follows +font +fonts +foo +food +foods +fool +foot +footage +football +footwear +for +forbes +forbidden +force +forced +forces +ford +forecast +forecasts +foreign +forest +forestry +forests +forever +forge +forget +forgot +forgotten +fork +form +formal +format +formation +formats +formatting +formed +former +formerly +forming +forms +formula +fort +forth +fortune +forty +forum +forums +forward +forwarding +fossil +foster +foto +fotos +fought +foul +found +foundation +foundations +founded +founder +fountain +four +fourth +fox +fp +fr +fraction +fragrance +fragrances +frame +framed +frames +framework +framing +france +franchise +francis +francisco +frank +frankfurt +franklin +fraser +fraud +fred +frederick +free +freebsd +freedom +freelance +freely +freeware +freeze +freight +french +frequencies +frequency +frequent +frequently +fresh +fri +friday +fridge +friend +friendly +friends +friendship +frog +from +front +frontier +frontpage +frost +frozen +fruit +fruits +fs +ft +ftp +fu +fuck +fucked +fucking +fuel +fuji +fujitsu +full +fully +fun +function +functional +functionality +functioning +functions +fund +fundamental +fundamentals +funded +funding +fundraising +funds +funeral +funk +funky +funny +fur +furnished +furnishings +furniture +further +furthermore +fusion +future +futures +fuzzy +fw +fwd +fx +fy +g +ga +gabriel +gadgets +gage +gain +gained +gains +galaxy +gale +galleries +gallery +gambling +game +gamecube +games +gamespot +gaming +gamma +gang +gangbang +gap +gaps +garage +garbage +garcia +garden +gardening +gardens +garlic +garmin +gary +gas +gasoline +gate +gates +gateway +gather +gathered +gathering +gauge +gave +gay +gays +gazette +gb +gba +gbp +gc +gcc +gd +gdp +ge +gear +geek +gel +gem +gen +gender +gene +genealogy +general +generally +generate +generated +generates +generating +generation +generations +generator +generators +generic +generous +genes +genesis +genetic +genetics +geneva +genius +genome +genre +genres +gentle +gentleman +gently +genuine +geo +geographic +geographical +geography +geological +geology +geometry +george +georgia +gerald +german +germany +get +gets +getting +gg +ghana +ghost +ghz +gi +giant +giants +gibraltar +gibson +gif +gift +gifts +gig +gilbert +girl +girlfriend +girls +gis +give +given +gives +giving +gl +glad +glance +glasgow +glass +glasses +glen +glenn +global +globe +glory +glossary +gloves +glow +glucose +gm +gmbh +gmc +gmt +gnome +gnu +go +goal +goals +goat +god +gods +goes +going +gold +golden +golf +gone +gonna +good +goods +google +gordon +gore +gorgeous +gospel +gossip +got +gothic +goto +gotta +gotten +gourmet +gov +governance +governing +government +governmental +governments +governor +govt +gp +gpl +gps +gr +grab +grace +grad +grade +grades +gradually +graduate +graduated +graduates +graduation +graham +grain +grammar +grams +grand +grande +granny +grant +granted +grants +graph +graphic +graphical +graphics +graphs +gras +grass +grateful +gratis +gratuit +grave +gravity +gray +great +greater +greatest +greatly +greece +greek +green +greene +greenhouse +greensboro +greeting +greetings +greg +gregory +grenada +grew +grey +grid +griffin +grill +grip +grocery +groove +gross +ground +grounds +groundwater +group +groups +grove +grow +growing +grown +grows +growth +gs +gsm +gst +gt +gtk +guam +guarantee +guaranteed +guarantees +guard +guardian +guards +guatemala +guess +guest +guestbook +guests +gui +guidance +guide +guided +guidelines +guides +guild +guilty +guinea +guitar +guitars +gulf +gun +guns +guru +guy +guyana +guys +gym +gzip +h +ha +habitat +habits +hack +hacker +had +hair +hairy +haiti +half +halfcom +halifax +hall +halloween +halo +ham +hamburg +hamilton +hammer +hampshire +hampton +hand +handbags +handbook +handed +handheld +handhelds +handjob +handjobs +handle +handled +handles +handling +handmade +hands +handy +hang +hanging +hans +hansen +happen +happened +happening +happens +happiness +happy +harassment +harbor +harbour +hard +hardcore +hardcover +harder +hardly +hardware +hardwood +harley +harm +harmful +harmony +harold +harper +harris +harrison +harry +hart +hartford +harvard +harvest +harvey +has +hash +hat +hate +hats +have +haven +having +hawaii +hawaiian +hawk +hay +hayes +hazard +hazardous +hazards +hb +hc +hd +hdtv +he +head +headed +header +headers +heading +headline +headlines +headphones +headquarters +heads +headset +healing +health +healthcare +healthy +hear +heard +hearing +hearings +heart +hearts +heat +heated +heater +heath +heather +heating +heaven +heavily +heavy +hebrew +heel +height +heights +held +helen +helena +helicopter +hell +hello +helmet +help +helped +helpful +helping +helps +hence +henderson +henry +hentai +hepatitis +her +herald +herb +herbal +herbs +here +hereby +herein +heritage +hero +heroes +herself +hewlett +hey +hh +hi +hidden +hide +hierarchy +high +higher +highest +highland +highlight +highlighted +highlights +highly +highs +highway +highways +hiking +hill +hills +hilton +him +himself +hindu +hint +hints +hip +hire +hired +hiring +his +hispanic +hist +historic +historical +history +hit +hitachi +hits +hitting +hiv +hk +hl +ho +hobbies +hobby +hockey +hold +holdem +holder +holders +holding +holdings +holds +hole +holes +holiday +holidays +holland +hollow +holly +hollywood +holmes +holocaust +holy +home +homeland +homeless +homepage +homes +hometown +homework +hon +honda +honduras +honest +honey +hong +honolulu +honor +honors +hood +hook +hop +hope +hoped +hopefully +hopes +hoping +hopkins +horizon +horizontal +hormone +horn +horny +horrible +horror +horse +horses +hose +hospital +hospitality +hospitals +host +hosted +hostel +hostels +hosting +hosts +hot +hotel +hotels +hotelscom +hotmail +hottest +hour +hourly +hours +house +household +households +houses +housewares +housewives +housing +houston +how +howard +however +howto +hp +hq +hr +href +hrs +hs +ht +html +http +hu +hub +hudson +huge +hugh +hughes +hugo +hull +human +humanitarian +humanities +humanity +humans +humidity +humor +hundred +hundreds +hung +hungarian +hungary +hunger +hungry +hunt +hunter +hunting +huntington +hurricane +hurt +husband +hwy +hybrid +hydraulic +hydrocodone +hydrogen +hygiene +hypothesis +hypothetical +hyundai +hz +i +ia +ian +ibm +ic +ice +iceland +icon +icons +icq +ict +id +idaho +ide +idea +ideal +ideas +identical +identification +identified +identifier +identifies +identify +identifying +identity +idle +idol +ids +ie +ieee +if +ignore +ignored +ii +iii +il +ill +illegal +illinois +illness +illustrated +illustration +illustrations +im +ima +image +images +imagination +imagine +imaging +img +immediate +immediately +immigrants +immigration +immune +immunology +impact +impacts +impaired +imperial +implement +implementation +implemented +implementing +implications +implied +implies +import +importance +important +importantly +imported +imports +impose +imposed +impossible +impressed +impression +impressive +improve +improved +improvement +improvements +improving +in +inappropriate +inbox +inc +incentive +incentives +incest +inch +inches +incidence +incident +incidents +incl +include +included +includes +including +inclusion +inclusive +income +incoming +incomplete +incorporate +incorporated +incorrect +increase +increased +increases +increasing +increasingly +incredible +incurred +ind +indeed +independence +independent +independently +index +indexed +indexes +india +indian +indiana +indianapolis +indians +indicate +indicated +indicates +indicating +indication +indicator +indicators +indices +indie +indigenous +indirect +individual +individually +individuals +indonesia +indonesian +indoor +induced +induction +industrial +industries +industry +inexpensive +inf +infant +infants +infected +infection +infections +infectious +infinite +inflation +influence +influenced +influences +info +inform +informal +information +informational +informative +informed +infrared +infrastructure +ing +ingredients +inherited +initial +initially +initiated +initiative +initiatives +injection +injured +injuries +injury +ink +inkjet +inline +inn +inner +innocent +innovation +innovations +innovative +inns +input +inputs +inquire +inquiries +inquiry +ins +insects +insert +inserted +insertion +inside +insider +insight +insights +inspection +inspections +inspector +inspiration +inspired +install +installation +installations +installed +installing +instance +instances +instant +instantly +instead +institute +institutes +institution +institutional +institutions +instruction +instructional +instructions +instructor +instructors +instrument +instrumental +instrumentation +instruments +insulin +insurance +insured +int +intake +integer +integral +integrate +integrated +integrating +integration +integrity +intel +intellectual +intelligence +intelligent +intend +intended +intense +intensity +intensive +intent +intention +inter +interact +interaction +interactions +interactive +interest +interested +interesting +interests +interface +interfaces +interference +interim +interior +intermediate +internal +international +internationally +internet +internship +interpretation +interpreted +interracial +intersection +interstate +interval +intervals +intervention +interventions +interview +interviews +intimate +intl +into +intranet +intro +introduce +introduced +introduces +introducing +introduction +introductory +invalid +invasion +invention +inventory +invest +investigate +investigated +investigation +investigations +investigator +investigators +investing +investment +investments +investor +investors +invisible +invision +invitation +invitations +invite +invited +invoice +involve +involved +involvement +involves +involving +io +ion +iowa +ip +ipaq +ipod +ips +ir +ira +iran +iraq +iraqi +irc +ireland +irish +iron +irrigation +irs +is +isa +isaac +isbn +islam +islamic +island +islands +isle +iso +isolated +isolation +isp +israel +israeli +issn +issue +issued +issues +ist +istanbul +it +italia +italian +italiano +italic +italy +item +items +its +itsa +itself +itunes +iv +ivory +ix +j +ja +jack +jacket +jackets +jackie +jackson +jacksonville +jacob +jade +jaguar +jail +jake +jam +jamaica +james +jamie +jan +jane +janet +january +japan +japanese +jar +jason +java +javascript +jay +jazz +jc +jd +je +jean +jeans +jeep +jeff +jefferson +jeffrey +jelsoft +jennifer +jenny +jeremy +jerry +jersey +jerusalem +jesse +jessica +jesus +jet +jets +jewel +jewellery +jewelry +jewish +jews +jill +jim +jimmy +jj +jm +jo +joan +job +jobs +joe +joel +john +johnny +johns +johnson +johnston +join +joined +joining +joins +joint +joke +jokes +jon +jonathan +jones +jordan +jose +joseph +josh +joshua +journal +journalism +journalist +journalists +journals +journey +joy +joyce +jp +jpeg +jpg +jr +js +juan +judge +judges +judgment +judicial +judy +juice +jul +julia +julian +julie +july +jump +jumping +jun +junction +june +jungle +junior +junk +jurisdiction +jury +just +justice +justify +justin +juvenile +jvc +k +ka +kai +kansas +karaoke +karen +karl +karma +kate +kathy +katie +katrina +kay +kazakhstan +kb +kde +keen +keep +keeping +keeps +keith +kelkoo +kelly +ken +kennedy +kenneth +kenny +keno +kent +kentucky +kenya +kept +kernel +kerry +kevin +key +keyboard +keyboards +keys +keyword +keywords +kg +kick +kid +kidney +kids +kijiji +kill +killed +killer +killing +kills +kilometers +kim +kinase +kind +kinda +kinds +king +kingdom +kings +kingston +kirk +kiss +kissing +kit +kitchen +kits +kitty +klein +km +knee +knew +knife +knight +knights +knit +knitting +knives +knock +know +knowing +knowledge +knowledgestorm +known +knows +ko +kodak +kong +korea +korean +kruger +ks +kurt +kuwait +kw +ky +kyle +l +la +lab +label +labeled +labels +labor +laboratories +laboratory +labour +labs +lace +lack +ladder +laden +ladies +lady +lafayette +laid +lake +lakes +lamb +lambda +lamp +lamps +lan +lancaster +lance +land +landing +lands +landscape +landscapes +lane +lanes +lang +language +languages +lanka +lap +laptop +laptops +large +largely +larger +largest +larry +las +laser +last +lasting +lat +late +lately +later +latest +latex +latin +latina +latinas +latino +latitude +latter +latvia +lauderdale +laugh +laughing +launch +launched +launches +laundry +laura +lauren +law +lawn +lawrence +laws +lawsuit +lawyer +lawyers +lay +layer +layers +layout +lazy +lb +lbs +lc +lcd +ld +le +lead +leader +leaders +leadership +leading +leads +leaf +league +lean +learn +learned +learners +learning +lease +leasing +least +leather +leave +leaves +leaving +lebanon +lecture +lectures +led +lee +leeds +left +leg +legacy +legal +legally +legend +legendary +legends +legislation +legislative +legislature +legitimate +legs +leisure +lemon +len +lender +lenders +lending +length +lens +lenses +leo +leon +leonard +leone +les +lesbian +lesbians +leslie +less +lesser +lesson +lessons +let +lets +letter +letters +letting +leu +level +levels +levitra +levy +lewis +lexington +lexmark +lexus +lf +lg +li +liabilities +liability +liable +lib +liberal +liberia +liberty +librarian +libraries +library +libs +licence +license +licensed +licenses +licensing +licking +lid +lie +liechtenstein +lies +life +lifestyle +lifetime +lift +light +lighter +lighting +lightning +lights +lightweight +like +liked +likelihood +likely +likes +likewise +lil +lime +limit +limitation +limitations +limited +limiting +limits +limousines +lincoln +linda +lindsay +line +linear +lined +lines +lingerie +link +linked +linking +links +linux +lion +lions +lip +lips +liquid +lisa +list +listed +listen +listening +listing +listings +listprice +lists +lit +lite +literacy +literally +literary +literature +lithuania +litigation +little +live +livecam +lived +liver +liverpool +lives +livesex +livestock +living +liz +ll +llc +lloyd +llp +lm +ln +lo +load +loaded +loading +loads +loan +loans +lobby +loc +local +locale +locally +locate +located +location +locations +locator +lock +locked +locking +locks +lodge +lodging +log +logan +logged +logging +logic +logical +login +logistics +logitech +logo +logos +logs +lol +lolita +london +lone +lonely +long +longer +longest +longitude +look +looked +looking +looks +looksmart +lookup +loop +loops +loose +lopez +lord +los +lose +losing +loss +losses +lost +lot +lots +lottery +lotus +lou +loud +louis +louise +louisiana +louisville +lounge +love +loved +lovely +lover +lovers +loves +loving +low +lower +lowest +lows +lp +ls +lt +ltd +lu +lucas +lucia +luck +lucky +lucy +luggage +luis +luke +lunch +lung +luther +luxembourg +luxury +lycos +lying +lynn +lyric +lyrics +m +ma +mac +macedonia +machine +machinery +machines +macintosh +macro +macromedia +mad +madagascar +made +madison +madness +madonna +madrid +mae +mag +magazine +magazines +magic +magical +magnet +magnetic +magnificent +magnitude +mai +maiden +mail +mailed +mailing +mailman +mails +mailto +main +maine +mainland +mainly +mainstream +maintain +maintained +maintaining +maintains +maintenance +major +majority +make +maker +makers +makes +makeup +making +malawi +malaysia +maldives +male +males +mali +mall +malpractice +malta +mambo +man +manage +managed +management +manager +managers +managing +manchester +mandate +mandatory +manga +manhattan +manitoba +manner +manor +manual +manually +manuals +manufacture +manufactured +manufacturer +manufacturers +manufacturing +many +map +maple +mapping +maps +mar +marathon +marble +marc +march +marco +marcus +mardi +margaret +margin +maria +mariah +marie +marijuana +marilyn +marina +marine +mario +marion +maritime +mark +marked +marker +markers +market +marketing +marketplace +markets +marking +marks +marriage +married +marriott +mars +marshall +mart +martha +martial +martin +marvel +mary +maryland +mas +mask +mason +mass +massachusetts +massage +massive +master +mastercard +masters +masturbating +masturbation +mat +match +matched +matches +matching +mate +material +materials +maternity +math +mathematical +mathematics +mating +matrix +mats +matt +matter +matters +matthew +mattress +mature +maui +mauritius +max +maximize +maximum +may +maybe +mayor +mazda +mb +mba +mc +mcdonald +md +me +meal +meals +mean +meaning +meaningful +means +meant +meanwhile +measure +measured +measurement +measurements +measures +measuring +meat +mechanical +mechanics +mechanism +mechanisms +med +medal +media +median +medicaid +medical +medicare +medication +medications +medicine +medicines +medieval +meditation +mediterranean +medium +medline +meet +meeting +meetings +meets +meetup +mega +mel +melbourne +melissa +mem +member +members +membership +membrane +memo +memorabilia +memorial +memories +memory +memphis +men +mens +ment +mental +mention +mentioned +mentor +menu +menus +mercedes +merchandise +merchant +merchants +mercury +mercy +mere +merely +merge +merger +merit +merry +mesa +mesh +mess +message +messages +messaging +messenger +met +meta +metabolism +metadata +metal +metallic +metallica +metals +meter +meters +method +methodology +methods +metres +metric +metro +metropolitan +mexican +mexico +meyer +mf +mfg +mg +mh +mhz +mi +mia +miami +mic +mice +michael +michel +michelle +michigan +micro +microphone +microsoft +microwave +mid +middle +midi +midlands +midnight +midwest +might +mighty +migration +mike +mil +milan +mild +mile +mileage +miles +milf +milfhunter +milfs +military +milk +mill +millennium +miller +million +millions +mills +milton +milwaukee +mime +min +mind +minds +mine +mineral +minerals +mines +mini +miniature +minimal +minimize +minimum +mining +minister +ministers +ministries +ministry +minneapolis +minnesota +minolta +minor +minority +mins +mint +minus +minute +minutes +miracle +mirror +mirrors +misc +miscellaneous +miss +missed +missile +missing +mission +missions +mississippi +missouri +mistake +mistakes +mistress +mit +mitchell +mitsubishi +mix +mixed +mixer +mixing +mixture +mj +ml +mlb +mls +mm +mn +mo +mobile +mobiles +mobility +mod +mode +model +modeling +modelling +models +modem +modems +moderate +moderator +moderators +modern +modes +modification +modifications +modified +modify +mods +modular +module +modules +moisture +mold +moldova +molecular +molecules +mom +moment +moments +momentum +moms +mon +monaco +monday +monetary +money +mongolia +monica +monitor +monitored +monitoring +monitors +monkey +mono +monroe +monster +montana +monte +montgomery +month +monthly +months +montreal +mood +moon +moore +moral +more +moreover +morgan +morning +morocco +morris +morrison +mortality +mortgage +mortgages +moscow +moses +moss +most +mostly +motel +motels +mother +motherboard +mothers +motion +motivated +motivation +motor +motorcycle +motorcycles +motorola +motors +mount +mountain +mountains +mounted +mounting +mounts +mouse +mouth +move +moved +movement +movements +movers +moves +movie +movies +moving +mozambique +mozilla +mp +mpeg +mpegs +mpg +mph +mr +mrna +mrs +ms +msg +msgid +msgstr +msie +msn +mt +mtv +mu +much +mud +mug +multi +multimedia +multiple +mumbai +munich +municipal +municipality +murder +murphy +murray +muscle +muscles +museum +museums +music +musical +musician +musicians +muslim +muslims +must +mustang +mutual +muze +mv +mw +mx +my +myanmar +myers +myrtle +myself +mysimon +myspace +mysql +mysterious +mystery +myth +n +na +nail +nails +naked +nam +name +named +namely +names +namespace +namibia +nancy +nano +naples +narrative +narrow +nasa +nascar +nasdaq +nashville +nasty +nat +nathan +nation +national +nationally +nations +nationwide +native +nato +natural +naturally +naturals +nature +naughty +nav +naval +navigate +navigation +navigator +navy +nb +nba +nbc +nc +ncaa +nd +ne +near +nearby +nearest +nearly +nebraska +nec +necessarily +necessary +necessity +neck +necklace +need +needed +needle +needs +negative +negotiation +negotiations +neighbor +neighborhood +neighbors +neil +neither +nelson +neo +neon +nepal +nerve +nervous +nest +nested +net +netherlands +netscape +network +networking +networks +neural +neutral +nevada +never +nevertheless +new +newark +newbie +newcastle +newer +newest +newfoundland +newly +newport +news +newscom +newsletter +newsletters +newspaper +newspapers +newton +next +nextel +nfl +ng +nh +nhl +nhs +ni +niagara +nicaragua +nice +nicholas +nick +nickel +nickname +nicole +niger +nigeria +night +nightlife +nightmare +nights +nike +nikon +nil +nine +nintendo +nipple +nipples +nirvana +nissan +nitrogen +nj +nl +nm +nn +no +noble +nobody +node +nodes +noise +nokia +nominated +nomination +nominations +non +none +nonprofit +noon +nor +norfolk +norm +normal +normally +norman +north +northeast +northern +northwest +norton +norway +norwegian +nos +nose +not +note +notebook +notebooks +noted +notes +nothing +notice +noticed +notices +notification +notifications +notified +notify +notion +notre +nottingham +nov +nova +novel +novels +novelty +november +now +nowhere +np +nr +ns +nsw +nt +ntsc +nu +nuclear +nude +nudist +nudity +nuke +null +number +numbers +numeric +numerical +numerous +nurse +nursery +nurses +nursing +nut +nutrition +nutritional +nuts +nutten +nv +nvidia +nw +ny +nyc +nylon +nz +o +oak +oakland +oaks +oasis +ob +obesity +obituaries +obj +object +objective +objectives +objects +obligation +obligations +observation +observations +observe +observed +observer +obtain +obtained +obtaining +obvious +obviously +oc +occasion +occasional +occasionally +occasions +occupation +occupational +occupations +occupied +occur +occurred +occurrence +occurring +occurs +ocean +oclc +oct +october +odd +odds +oe +oecd +oem +of +off +offense +offensive +offer +offered +offering +offerings +offers +office +officer +officers +offices +official +officially +officials +offline +offset +offshore +often +og +oh +ohio +oil +oils +ok +okay +oklahoma +ol +old +older +oldest +olive +oliver +olympic +olympics +olympus +om +omaha +oman +omega +omissions +on +once +one +ones +ongoing +onion +online +only +ons +ontario +onto +oo +ooo +oops +op +open +opened +opening +openings +opens +opera +operate +operated +operates +operating +operation +operational +operations +operator +operators +opinion +opinions +opponent +opponents +opportunities +opportunity +opposed +opposite +opposition +opt +optical +optics +optimal +optimization +optimize +optimum +option +optional +options +or +oracle +oral +orange +orbit +orchestra +order +ordered +ordering +orders +ordinance +ordinary +oregon +org +organ +organic +organisation +organisations +organised +organisms +organization +organizational +organizations +organize +organized +organizer +organizing +orgasm +orgy +oriental +orientation +oriented +origin +original +originally +origins +orlando +orleans +os +oscar +ot +other +others +otherwise +ottawa +ou +ought +our +ours +ourselves +out +outcome +outcomes +outdoor +outdoors +outer +outlet +outline +outlined +outlook +output +outputs +outreach +outside +outsourcing +outstanding +oval +oven +over +overall +overcome +overhead +overnight +overseas +overview +owen +own +owned +owner +owners +ownership +owns +oxford +oxide +oxygen +oz +ozone +p +pa +pac +pace +pacific +pack +package +packages +packaging +packard +packed +packet +packets +packing +packs +pad +pads +page +pages +paid +pain +painful +paint +paintball +painted +painting +paintings +pair +pairs +pakistan +pal +palace +pale +palestine +palestinian +palm +palmer +pam +pamela +pan +panama +panasonic +panel +panels +panic +panties +pants +pantyhose +paper +paperback +paperbacks +papers +papua +par +para +parade +paradise +paragraph +paragraphs +paraguay +parallel +parameter +parameters +parcel +parent +parental +parenting +parents +paris +parish +park +parker +parking +parks +parliament +parliamentary +part +partial +partially +participant +participants +participate +participated +participating +participation +particle +particles +particular +particularly +parties +partition +partly +partner +partners +partnership +partnerships +parts +party +pas +paso +pass +passage +passed +passenger +passengers +passes +passing +passion +passive +passport +password +passwords +past +pasta +paste +pastor +pat +patch +patches +patent +patents +path +pathology +paths +patient +patients +patio +patricia +patrick +patrol +pattern +patterns +paul +pavilion +paxil +pay +payable +payday +paying +payment +payments +paypal +payroll +pays +pb +pc +pci +pcs +pct +pd +pda +pdas +pdf +pdt +pe +peace +peaceful +peak +pearl +peas +pediatric +pee +peeing +peer +peers +pen +penalties +penalty +pencil +pendant +pending +penetration +penguin +peninsula +penis +penn +pennsylvania +penny +pens +pension +pensions +pentium +people +peoples +pepper +per +perceived +percent +percentage +perception +perfect +perfectly +perform +performance +performances +performed +performer +performing +performs +perfume +perhaps +period +periodic +periodically +periods +peripheral +peripherals +perl +permalink +permanent +permission +permissions +permit +permits +permitted +perry +persian +persistent +person +personal +personality +personalized +personally +personals +personnel +persons +perspective +perspectives +perth +peru +pest +pet +pete +peter +petersburg +peterson +petite +petition +petroleum +pets +pf +pg +pgp +ph +phantom +pharmaceutical +pharmaceuticals +pharmacies +pharmacology +pharmacy +phase +phases +phd +phenomenon +phentermine +phi +phil +philadelphia +philip +philippines +philips +phillips +philosophy +phoenix +phone +phones +photo +photograph +photographer +photographers +photographic +photographs +photography +photos +photoshop +php +phpbb +phrase +phrases +phys +physical +physically +physician +physicians +physics +physiology +pi +piano +pic +pichunter +pick +picked +picking +picks +pickup +picnic +pics +picture +pictures +pie +piece +pieces +pierce +pierre +pig +pike +pill +pillow +pills +pilot +pin +pine +ping +pink +pins +pioneer +pipe +pipeline +pipes +pirates +piss +pissing +pit +pitch +pittsburgh +pix +pixel +pixels +pizza +pj +pk +pl +place +placed +placement +places +placing +plain +plains +plaintiff +plan +plane +planes +planet +planets +planned +planner +planners +planning +plans +plant +plants +plasma +plastic +plastics +plate +plates +platform +platforms +platinum +play +playback +playboy +played +player +players +playing +playlist +plays +playstation +plaza +plc +pleasant +please +pleased +pleasure +pledge +plenty +plot +plots +plug +plugin +plugins +plumbing +plus +plymouth +pm +pmc +pmid +pn +po +pocket +pockets +pod +podcast +podcasts +poem +poems +poet +poetry +point +pointed +pointer +pointing +points +pokemon +poker +poland +polar +pole +police +policies +policy +polish +polished +political +politicians +politics +poll +polls +pollution +polo +poly +polyester +polymer +polyphonic +pond +pontiac +pool +pools +poor +pop +pope +popular +popularity +population +populations +por +porcelain +pork +porn +porno +porsche +port +portable +portal +porter +portfolio +portion +portions +portland +portrait +portraits +ports +portsmouth +portugal +portuguese +pos +pose +posing +position +positioning +positions +positive +possess +possession +possibilities +possibility +possible +possibly +post +postage +postal +postcard +postcards +posted +poster +posters +posting +postings +postposted +posts +pot +potato +potatoes +potential +potentially +potter +pottery +poultry +pound +pounds +pour +poverty +powder +powell +power +powered +powerful +powerpoint +powers +powerseller +pp +ppc +ppm +pr +practical +practice +practices +practitioner +practitioners +prague +prairie +praise +pray +prayer +prayers +pre +preceding +precious +precipitation +precise +precisely +precision +predict +predicted +prediction +predictions +prefer +preference +preferences +preferred +prefers +prefix +pregnancy +pregnant +preliminary +premier +premiere +premises +premium +prep +prepaid +preparation +prepare +prepared +preparing +prerequisite +prescribed +prescription +presence +present +presentation +presentations +presented +presenting +presently +presents +preservation +preserve +president +presidential +press +pressed +pressing +pressure +preston +pretty +prev +prevent +preventing +prevention +preview +previews +previous +previously +price +priced +prices +pricing +pride +priest +primarily +primary +prime +prince +princess +princeton +principal +principle +principles +print +printable +printed +printer +printers +printing +prints +prior +priorities +priority +prison +prisoner +prisoners +privacy +private +privilege +privileges +prix +prize +prizes +pro +probability +probably +probe +problem +problems +proc +procedure +procedures +proceed +proceeding +proceedings +proceeds +process +processed +processes +processing +processor +processors +procurement +produce +produced +producer +producers +produces +producing +product +production +productions +productive +productivity +products +prof +profession +professional +professionals +professor +profile +profiles +profit +profits +program +programme +programmer +programmers +programmes +programming +programs +progress +progressive +prohibited +project +projected +projection +projector +projectors +projects +prominent +promise +promised +promises +promising +promo +promote +promoted +promotes +promoting +promotion +promotional +promotions +prompt +promptly +proof +propecia +proper +properly +properties +property +prophet +proportion +proposal +proposals +propose +proposed +proposition +proprietary +pros +prospect +prospective +prospects +prostate +prostores +prot +protect +protected +protecting +protection +protective +protein +proteins +protest +protocol +protocols +prototype +proud +proudly +prove +proved +proven +provide +provided +providence +provider +providers +provides +providing +province +provinces +provincial +provision +provisions +proxy +prozac +ps +psi +psp +pst +psychiatry +psychological +psychology +pt +pts +pty +pub +public +publication +publications +publicity +publicly +publish +published +publisher +publishers +publishing +pubmed +pubs +puerto +pull +pulled +pulling +pulse +pump +pumps +punch +punishment +punk +pupils +puppy +purchase +purchased +purchases +purchasing +pure +purple +purpose +purposes +purse +pursuant +pursue +pursuit +push +pushed +pushing +pussy +put +puts +putting +puzzle +puzzles +pvc +python +q +qatar +qc +qld +qt +qty +quad +qualification +qualifications +qualified +qualify +qualifying +qualities +quality +quantitative +quantities +quantity +quantum +quarter +quarterly +quarters +que +quebec +queen +queens +queensland +queries +query +quest +question +questionnaire +questions +queue +qui +quick +quickly +quiet +quilt +quit +quite +quiz +quizzes +quotations +quote +quoted +quotes +r +ra +rabbit +race +races +rachel +racial +racing +rack +racks +radar +radiation +radical +radio +radios +radius +rage +raid +rail +railroad +railway +rain +rainbow +raise +raised +raises +raising +raleigh +rally +ralph +ram +ran +ranch +rand +random +randy +range +rangers +ranges +ranging +rank +ranked +ranking +rankings +ranks +rap +rape +rapid +rapidly +rapids +rare +rarely +rat +rate +rated +rates +rather +rating +ratings +ratio +rational +ratios +rats +raw +ray +raymond +rays +rb +rc +rca +rd +re +reach +reached +reaches +reaching +reaction +reactions +read +reader +readers +readily +reading +readings +reads +ready +real +realistic +reality +realize +realized +really +realm +realtor +realtors +realty +rear +reason +reasonable +reasonably +reasoning +reasons +rebate +rebates +rebecca +rebel +rebound +rec +recall +receipt +receive +received +receiver +receivers +receives +receiving +recent +recently +reception +receptor +receptors +recipe +recipes +recipient +recipients +recognised +recognition +recognize +recognized +recommend +recommendation +recommendations +recommended +recommends +reconstruction +record +recorded +recorder +recorders +recording +recordings +records +recover +recovered +recovery +recreation +recreational +recruiting +recruitment +recycling +red +redeem +redhead +reduce +reduced +reduces +reducing +reduction +reductions +reed +reef +reel +ref +refer +reference +referenced +references +referral +referrals +referred +referring +refers +refinance +refine +refined +reflect +reflected +reflection +reflections +reflects +reform +reforms +refresh +refrigerator +refugees +refund +refurbished +refuse +refused +reg +regard +regarded +regarding +regardless +regards +reggae +regime +region +regional +regions +register +registered +registrar +registration +registry +regression +regular +regularly +regulated +regulation +regulations +regulatory +rehab +rehabilitation +reid +reject +rejected +rel +relate +related +relates +relating +relation +relations +relationship +relationships +relative +relatively +relatives +relax +relaxation +relay +release +released +releases +relevance +relevant +reliability +reliable +reliance +relief +religion +religions +religious +reload +relocation +rely +relying +remain +remainder +remained +remaining +remains +remark +remarkable +remarks +remedies +remedy +remember +remembered +remind +reminder +remix +remote +removable +removal +remove +removed +removing +renaissance +render +rendered +rendering +renew +renewable +renewal +reno +rent +rental +rentals +rentcom +rep +repair +repairs +repeat +repeated +replace +replaced +replacement +replacing +replica +replication +replied +replies +reply +report +reported +reporter +reporters +reporting +reports +repository +represent +representation +representations +representative +representatives +represented +representing +represents +reprint +reprints +reproduce +reproduced +reproduction +reproductive +republic +republican +republicans +reputation +request +requested +requesting +requests +require +required +requirement +requirements +requires +requiring +res +rescue +research +researcher +researchers +reseller +reservation +reservations +reserve +reserved +reserves +reservoir +reset +residence +resident +residential +residents +resist +resistance +resistant +resolution +resolutions +resolve +resolved +resort +resorts +resource +resources +respect +respected +respective +respectively +respiratory +respond +responded +respondent +respondents +responding +response +responses +responsibilities +responsibility +responsible +rest +restaurant +restaurants +restoration +restore +restored +restrict +restricted +restriction +restrictions +restructuring +result +resulted +resulting +results +resume +resumes +retail +retailer +retailers +retain +retained +retention +retired +retirement +retreat +retrieval +retrieve +retrieved +retro +return +returned +returning +returns +reunion +reuters +rev +reveal +revealed +reveals +revelation +revenge +revenue +revenues +reverse +review +reviewed +reviewer +reviewing +reviews +revised +revision +revisions +revolution +revolutionary +reward +rewards +reynolds +rf +rfc +rg +rh +rhode +rhythm +ri +ribbon +rica +rice +rich +richard +richards +richardson +richmond +rick +rico +rid +ride +rider +riders +rides +ridge +riding +right +rights +rim +ring +rings +ringtone +ringtones +rio +rip +ripe +rise +rising +risk +risks +river +rivers +riverside +rj +rl +rm +rn +rna +ro +road +roads +rob +robert +roberts +robertson +robin +robinson +robot +robots +robust +rochester +rock +rocket +rocks +rocky +rod +roger +rogers +roland +role +roles +roll +rolled +roller +rolling +rolls +rom +roman +romance +romania +romantic +rome +ron +ronald +roof +room +roommate +roommates +rooms +root +roots +rope +rosa +rose +roses +ross +roster +rotary +rotation +rouge +rough +roughly +roulette +round +rounds +route +router +routers +routes +routine +routines +routing +rover +row +rows +roy +royal +royalty +rp +rpg +rpm +rr +rrp +rs +rss +rt +ru +rubber +ruby +rug +rugby +rugs +rule +ruled +rules +ruling +run +runner +running +runs +runtime +rural +rush +russell +russia +russian +ruth +rv +rw +rwanda +rx +ryan +s +sa +sacramento +sacred +sacrifice +sad +saddam +safari +safe +safely +safer +safety +sage +sagem +said +sail +sailing +saint +saints +sake +salad +salaries +salary +sale +salem +sales +sally +salmon +salon +salt +salvador +salvation +sam +samba +same +samoa +sample +samples +sampling +samsung +samuel +san +sand +sandra +sandwich +sandy +sans +santa +sanyo +sao +sap +sapphire +sara +sarah +sas +saskatchewan +sat +satellite +satin +satisfaction +satisfactory +satisfied +satisfy +saturday +saturn +sauce +saudi +savage +savannah +save +saved +saver +saves +saving +savings +saw +say +saying +says +sb +sbjct +sc +scale +scales +scan +scanned +scanner +scanners +scanning +scary +scenario +scenarios +scene +scenes +scenic +schedule +scheduled +schedules +scheduling +schema +scheme +schemes +scholar +scholars +scholarship +scholarships +school +schools +sci +science +sciences +scientific +scientist +scientists +scoop +scope +score +scored +scores +scoring +scotia +scotland +scott +scottish +scout +scratch +screen +screening +screens +screensaver +screensavers +screenshot +screenshots +screw +script +scripting +scripts +scroll +scsi +scuba +sculpture +sd +se +sea +seafood +seal +sealed +sean +search +searchcom +searched +searches +searching +seas +season +seasonal +seasons +seat +seating +seats +seattle +sec +second +secondary +seconds +secret +secretariat +secretary +secrets +section +sections +sector +sectors +secure +secured +securely +securities +security +see +seed +seeds +seeing +seek +seeker +seekers +seeking +seeks +seem +seemed +seems +seen +sees +sega +segment +segments +select +selected +selecting +selection +selections +selective +self +sell +seller +sellers +selling +sells +semester +semi +semiconductor +seminar +seminars +sen +senate +senator +senators +send +sender +sending +sends +senegal +senior +seniors +sense +sensitive +sensitivity +sensor +sensors +sent +sentence +sentences +seo +sep +separate +separated +separately +separation +sept +september +seq +sequence +sequences +ser +serbia +serial +series +serious +seriously +serum +serve +served +server +servers +serves +service +services +serving +session +sessions +set +sets +setting +settings +settle +settled +settlement +setup +seven +seventh +several +severe +sewing +sex +sexcam +sexo +sexual +sexuality +sexually +sexy +sf +sg +sh +shade +shades +shadow +shadows +shaft +shake +shakespeare +shakira +shall +shame +shanghai +shannon +shape +shaped +shapes +share +shared +shareholders +shares +shareware +sharing +shark +sharon +sharp +shaved +shaw +she +shed +sheep +sheer +sheet +sheets +sheffield +shelf +shell +shelter +shemale +shemales +shepherd +sheriff +sherman +shield +shift +shine +ship +shipment +shipments +shipped +shipping +ships +shirt +shirts +shit +shock +shoe +shoes +shoot +shooting +shop +shopper +shoppercom +shoppers +shopping +shoppingcom +shops +shopzilla +shore +short +shortcuts +shorter +shortly +shorts +shot +shots +should +shoulder +show +showcase +showed +shower +showers +showing +shown +shows +showtimes +shut +shuttle +si +sic +sick +side +sides +sie +siemens +sierra +sig +sight +sigma +sign +signal +signals +signature +signatures +signed +significance +significant +significantly +signing +signs +signup +silence +silent +silicon +silk +silly +silver +sim +similar +similarly +simon +simple +simplified +simply +simpson +simpsons +sims +simulation +simulations +simultaneously +sin +since +sing +singapore +singer +singh +singing +single +singles +sink +sip +sir +sister +sisters +sit +site +sitemap +sites +sitting +situated +situation +situations +six +sixth +size +sized +sizes +sk +skating +ski +skiing +skill +skilled +skills +skin +skins +skip +skirt +skirts +sku +sky +skype +sl +slave +sleep +sleeping +sleeps +sleeve +slide +slides +slideshow +slight +slightly +slim +slip +slope +slot +slots +slovak +slovakia +slovenia +slow +slowly +slut +sluts +sm +small +smaller +smart +smell +smile +smilies +smith +smithsonian +smoke +smoking +smooth +sms +smtp +sn +snake +snap +snapshot +snow +snowboard +so +soa +soap +soc +soccer +social +societies +society +sociology +socket +socks +sodium +sofa +soft +softball +software +soil +sol +solar +solaris +sold +soldier +soldiers +sole +solely +solid +solo +solomon +solution +solutions +solve +solved +solving +soma +somalia +some +somebody +somehow +someone +somerset +something +sometimes +somewhat +somewhere +son +song +songs +sonic +sons +sony +soon +soonest +sophisticated +sorry +sort +sorted +sorts +sought +soul +souls +sound +sounds +soundtrack +soup +source +sources +south +southampton +southeast +southern +southwest +soviet +sox +sp +spa +space +spaces +spain +spam +span +spanish +spank +spanking +sparc +spare +spas +spatial +speak +speaker +speakers +speaking +speaks +spears +spec +special +specialist +specialists +specialized +specializing +specially +specials +specialties +specialty +species +specific +specifically +specification +specifications +specifics +specified +specifies +specify +specs +spectacular +spectrum +speech +speeches +speed +speeds +spell +spelling +spencer +spend +spending +spent +sperm +sphere +spice +spider +spies +spin +spine +spirit +spirits +spiritual +spirituality +split +spoke +spoken +spokesman +sponsor +sponsored +sponsors +sponsorship +sport +sporting +sports +spot +spotlight +spots +spouse +spray +spread +spreading +spring +springer +springfield +springs +sprint +spy +spyware +sq +sql +squad +square +squirt +squirting +sr +src +sri +ss +ssl +st +stability +stable +stack +stadium +staff +staffing +stage +stages +stainless +stakeholders +stamp +stamps +stan +stand +standard +standards +standing +standings +stands +stanford +stanley +star +starring +stars +starsmerchant +start +started +starter +starting +starts +startup +stat +state +stated +statement +statements +states +statewide +static +stating +station +stationery +stations +statistical +statistics +stats +status +statute +statutes +statutory +stay +stayed +staying +stays +std +ste +steady +steal +steam +steel +steering +stem +step +stephanie +stephen +steps +stereo +sterling +steve +steven +stevens +stewart +stick +sticker +stickers +sticks +sticky +still +stock +stockholm +stockings +stocks +stolen +stomach +stone +stones +stood +stop +stopped +stopping +stops +storage +store +stored +stores +stories +storm +story +str +straight +strain +strand +strange +stranger +strap +strategic +strategies +strategy +stream +streaming +streams +street +streets +strength +strengthen +strengthening +strengths +stress +stretch +strict +strictly +strike +strikes +striking +string +strings +strip +stripes +strips +stroke +strong +stronger +strongly +struck +struct +structural +structure +structured +structures +struggle +stuart +stuck +stud +student +students +studied +studies +studio +studios +study +studying +stuff +stuffed +stunning +stupid +style +styles +stylish +stylus +su +sub +subaru +subcommittee +subdivision +subject +subjects +sublime +sublimedirectory +submission +submissions +submit +submitted +submitting +subscribe +subscriber +subscribers +subscription +subscriptions +subsection +subsequent +subsequently +subsidiaries +subsidiary +substance +substances +substantial +substantially +substitute +subtle +suburban +succeed +success +successful +successfully +such +suck +sucking +sucks +sudan +sudden +suddenly +sue +suffer +suffered +suffering +sufficient +sufficiently +sugar +suggest +suggested +suggesting +suggestion +suggestions +suggests +suicide +suit +suitable +suite +suited +suites +suits +sullivan +sum +summaries +summary +summer +summit +sun +sunday +sunglasses +sunny +sunrise +sunset +sunshine +super +superb +superintendent +superior +supervision +supervisor +supervisors +supplement +supplemental +supplements +supplied +supplier +suppliers +supplies +supply +support +supported +supporters +supporting +supports +suppose +supposed +supreme +sur +sure +surely +surf +surface +surfaces +surfing +surge +surgeon +surgeons +surgery +surgical +surname +surplus +surprise +surprised +surprising +surrey +surround +surrounded +surrounding +surveillance +survey +surveys +survival +survive +survivor +survivors +susan +suse +suspect +suspected +suspended +suspension +sussex +sustainability +sustainable +sustained +suzuki +sv +sw +swap +sweden +swedish +sweet +swift +swim +swimming +swing +swingers +swiss +switch +switched +switches +switching +switzerland +sword +sydney +symantec +symbol +symbols +sympathy +symphony +symposium +symptoms +sync +syndicate +syndication +syndrome +synopsis +syntax +synthesis +synthetic +syracuse +syria +sys +system +systematic +systems +t +ta +tab +table +tables +tablet +tablets +tabs +tackle +tactics +tag +tagged +tags +tahoe +tail +taiwan +take +taken +takes +taking +tale +talent +talented +tales +talk +talked +talking +talks +tall +tamil +tampa +tan +tank +tanks +tanzania +tap +tape +tapes +tar +target +targeted +targets +tariff +task +tasks +taste +tattoo +taught +tax +taxation +taxes +taxi +taylor +tb +tba +tc +tcp +td +te +tea +teach +teacher +teachers +teaches +teaching +team +teams +tear +tears +tech +technical +technician +technique +techniques +techno +technological +technologies +technology +techrepublic +ted +teddy +tee +teen +teenage +teens +teeth +tel +telecharger +telecom +telecommunications +telephone +telephony +telescope +television +televisions +tell +telling +tells +temp +temperature +temperatures +template +templates +temple +temporal +temporarily +temporary +ten +tenant +tend +tender +tennessee +tennis +tension +tent +term +terminal +terminals +termination +terminology +terms +terrace +terrain +terrible +territories +territory +terror +terrorism +terrorist +terrorists +terry +test +testament +tested +testimonials +testimony +testing +tests +tex +texas +text +textbook +textbooks +textile +textiles +texts +texture +tf +tft +tgp +th +thai +thailand +than +thank +thanks +thanksgiving +that +thats +the +theater +theaters +theatre +thee +theft +thehun +their +them +theme +themes +themselves +then +theology +theorem +theoretical +theories +theory +therapeutic +therapist +therapy +there +thereafter +thereby +therefore +thereof +thermal +thesaurus +these +thesis +they +thick +thickness +thin +thing +things +think +thinking +thinkpad +thinks +third +thirty +this +thomas +thompson +thomson +thong +thongs +thorough +thoroughly +those +thou +though +thought +thoughts +thousand +thousands +thread +threaded +threads +threat +threatened +threatening +threats +three +threesome +threshold +thriller +throat +through +throughout +throw +throwing +thrown +throws +thru +thu +thumb +thumbnail +thumbnails +thumbs +thumbzilla +thunder +thursday +thus +thy +ti +ticket +tickets +tide +tie +tied +tier +ties +tiffany +tiger +tigers +tight +til +tile +tiles +till +tim +timber +time +timeline +timely +timer +times +timing +timothy +tin +tiny +tion +tions +tip +tips +tire +tired +tires +tissue +tit +titanium +titans +title +titled +titles +tits +titten +tm +tmp +tn +to +tobacco +tobago +today +todd +toddler +toe +together +toilet +token +tokyo +told +tolerance +toll +tom +tomato +tomatoes +tommy +tomorrow +ton +tone +toner +tones +tongue +tonight +tons +tony +too +took +tool +toolbar +toolbox +toolkit +tools +tooth +top +topic +topics +topless +tops +toronto +torture +toshiba +total +totally +totals +touch +touched +tough +tour +touring +tourism +tourist +tournament +tournaments +tours +toward +towards +tower +towers +town +towns +township +toxic +toy +toyota +toys +tp +tr +trace +track +trackback +trackbacks +tracked +tracker +tracking +tracks +tract +tractor +tracy +trade +trademark +trademarks +trader +trades +trading +tradition +traditional +traditions +traffic +tragedy +trail +trailer +trailers +trails +train +trained +trainer +trainers +training +trains +tramadol +trance +tranny +trans +transaction +transactions +transcript +transcription +transcripts +transexual +transexuales +transfer +transferred +transfers +transform +transformation +transit +transition +translate +translated +translation +translations +translator +transmission +transmit +transmitted +transparency +transparent +transport +transportation +transsexual +trap +trash +trauma +travel +traveler +travelers +traveling +traveller +travelling +travels +travesti +travis +tray +treasure +treasurer +treasures +treasury +treat +treated +treating +treatment +treatments +treaty +tree +trees +trek +trembl +tremendous +trend +trends +treo +tri +trial +trials +triangle +tribal +tribe +tribes +tribunal +tribune +tribute +trick +tricks +tried +tries +trigger +trim +trinidad +trinity +trio +trip +tripadvisor +triple +trips +triumph +trivia +troops +tropical +trouble +troubleshooting +trout +troy +truck +trucks +true +truly +trunk +trust +trusted +trustee +trustees +trusts +truth +try +trying +ts +tsunami +tt +tu +tub +tube +tubes +tucson +tue +tuesday +tuition +tulsa +tumor +tune +tuner +tunes +tuning +tunisia +tunnel +turbo +turkey +turkish +turn +turned +turner +turning +turns +turtle +tutorial +tutorials +tv +tvcom +tvs +twelve +twenty +twice +twiki +twin +twinks +twins +twist +twisted +two +tx +ty +tyler +type +types +typical +typically +typing +u +uc +uganda +ugly +uh +ui +uk +ukraine +ul +ultimate +ultimately +ultra +ultram +um +un +una +unable +unauthorized +unavailable +uncertainty +uncle +und +undefined +under +undergraduate +underground +underlying +understand +understanding +understood +undertake +undertaken +underwear +undo +une +unemployment +unexpected +unfortunately +uni +unified +uniform +union +unions +uniprotkb +unique +unit +united +units +unity +univ +universal +universe +universities +university +unix +unknown +unless +unlike +unlikely +unlimited +unlock +unnecessary +unsigned +unsubscribe +until +untitled +unto +unusual +unwrap +up +upc +upcoming +update +updated +updates +updating +upgrade +upgrades +upgrading +upload +uploaded +upon +upper +ups +upset +upskirt +upskirts +ur +urban +urge +urgent +uri +url +urls +uruguay +urw +us +usa +usage +usb +usc +usd +usda +use +used +useful +user +username +users +uses +usgs +using +usps +usr +usual +usually +ut +utah +utc +utilities +utility +utilization +utilize +utils +uv +uw +uzbekistan +v +va +vacancies +vacation +vacations +vaccine +vacuum +vagina +val +valentine +valid +validation +validity +valium +valley +valuable +valuation +value +valued +values +valve +valves +vampire +van +vancouver +vanilla +var +variable +variables +variance +variation +variations +varied +varies +variety +various +vary +varying +vast +vat +vatican +vault +vb +vbulletin +vc +vcr +ve +vector +vegas +vegetable +vegetables +vegetarian +vegetation +vehicle +vehicles +velocity +velvet +vendor +vendors +venezuela +venice +venture +ventures +venue +venues +ver +verbal +verde +verification +verified +verify +verizon +vermont +vernon +verse +version +versions +versus +vertex +vertical +very +verzeichnis +vessel +vessels +veteran +veterans +veterinary +vg +vhs +vi +via +viagra +vibrator +vibrators +vic +vice +victim +victims +victor +victoria +victorian +victory +vid +video +videos +vids +vienna +vietnam +vietnamese +view +viewed +viewer +viewers +viewing +viewpicture +views +vii +viii +viking +villa +village +villages +villas +vincent +vintage +vinyl +violation +violations +violence +violent +violin +vip +viral +virgin +virginia +virtual +virtually +virtue +virus +viruses +visa +visibility +visible +vision +visit +visited +visiting +visitor +visitors +visits +vista +visual +vital +vitamin +vitamins +vocabulary +vocal +vocals +vocational +voice +voices +void +voip +vol +volkswagen +volleyball +volt +voltage +volume +volumes +voluntary +volunteer +volunteers +volvo +von +vote +voted +voters +votes +voting +voyeur +voyeurweb +voyuer +vp +vpn +vs +vsnet +vt +vulnerability +vulnerable +w +wa +wage +wages +wagner +wagon +wait +waiting +waiver +wake +wal +wales +walk +walked +walker +walking +walks +wall +wallace +wallet +wallpaper +wallpapers +walls +walnut +walt +walter +wan +wang +wanna +want +wanted +wanting +wants +war +warcraft +ward +ware +warehouse +warm +warming +warned +warner +warning +warnings +warrant +warranties +warranty +warren +warrior +warriors +wars +was +wash +washer +washing +washington +waste +watch +watched +watches +watching +water +waterproof +waters +watershed +watson +watt +watts +wav +wave +waves +wax +way +wayne +ways +wb +wc +we +weak +wealth +weapon +weapons +wear +wearing +weather +web +webcam +webcams +webcast +weblog +weblogs +webmaster +webmasters +webpage +webshots +website +websites +webster +wed +wedding +weddings +wednesday +weed +week +weekend +weekends +weekly +weeks +weight +weighted +weights +weird +welcome +welding +welfare +well +wellington +wellness +wells +welsh +wendy +went +were +wesley +west +western +westminster +wet +whale +what +whatever +whats +wheat +wheel +wheels +when +whenever +where +whereas +wherever +whether +which +while +whilst +white +who +whole +wholesale +whom +whore +whose +why +wi +wichita +wicked +wide +widely +wider +widescreen +widespread +width +wife +wifi +wiki +wikipedia +wild +wilderness +wildlife +wiley +will +william +williams +willing +willow +wilson +win +wind +window +windows +winds +windsor +wine +wines +wing +wings +winner +winners +winning +wins +winston +winter +wire +wired +wireless +wires +wiring +wisconsin +wisdom +wise +wish +wishes +wishlist +wit +witch +with +withdrawal +within +without +witness +witnesses +wives +wizard +wm +wma +wn +wolf +woman +women +womens +won +wonder +wonderful +wondering +wood +wooden +woods +wool +worcester +word +wordpress +words +work +worked +worker +workers +workflow +workforce +working +workout +workplace +works +workshop +workshops +workstation +world +worldcat +worlds +worldsex +worldwide +worm +worn +worried +worry +worse +worship +worst +worth +worthy +would +wound +wow +wp +wr +wrap +wrapped +wrapping +wrestling +wright +wrist +write +writer +writers +writes +writing +writings +written +wrong +wrote +ws +wt +wto +wu +wv +ww +www +wx +wy +wyoming +x +xanax +xbox +xerox +xhtml +xi +xl +xml +xnxx +xp +xx +xxx +y +ya +yacht +yahoo +yale +yamaha +yang +yard +yards +yarn +ye +yea +yeah +year +yearly +years +yeast +yellow +yemen +yen +yes +yesterday +yet +yield +yields +yn +yo +yoga +york +yorkshire +you +young +younger +your +yours +yourself +youth +yr +yrs +yu +yugoslavia +yukon +z +za +zambia +zdnet +zealand +zen +zero +zimbabwe +zinc +zip +zoloft +zone +zones +zoning +zoo +zoom +zoophilia +zope +zshops +zu +zum +zus \ No newline at end of file diff --git a/scripts/format b/scripts/format new file mode 100644 index 0000000..e4b104e --- /dev/null +++ b/scripts/format @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +clang-format -i cs162/wk*/**/*.cc cs162/wk*/**/*.hh -- cgit v1.2.3