38 Matching Annotations
  1. Jul 2022
    1. [X X -> Boolean]

      comparison. how do i know if its sorted function

    1. cmp

      sorting criteria function. you want to apply this guy to some list eventually. cmp tells us what it means to be sorted

  2. Mar 2020
    1. The first language always provides some forms of atomic data; to represent the variety of information in the real world

      for example, real world data might be a temperature. We need some language of describing the temperature data such as a number

    1. Methods are nothing more than properties that hold function values. This is a simple method

      Many built in objects have methods such as

      Array.forEach
      
  3. Feb 2020
    1. If you have any questions, be sure to ask. Good luck.

      OUTPUT is air filter model number

      INPUT

      1. make
      2. year
      3. cylindres

      EXAMPLE

      Edsel 1986 6

      E8606

    1. You'll need to round up the calculation on the right-hand-side of this formula. If the result calculated for N above has no fractional part, add an extra gallon for safety sake.

      for this its okay to use ceil or round http://www.cplusplus.com/reference/cmath/ceil/

    2. Make your prompt for input friendly and clear. The same goes for the output. You should always start with a "welcoming" message in your programs. Something like:

      then and only after you did part 1, make a commnd line interface

      COMMANDS

      do 3 separate inputs

      enter children amount (cant be partial)
      enter surface area
      enter days
      
    3. Specifications: You are to write a simple program to help a painter decide how much paint to buy for a job dependent on certain relevent and irrelevent input data. Here's how it works

      write a function that takes nc, S, nd

      output N where N is number of galls of paint to purchase

    1. type: floating point allocation: 4 bytes precision: you get 6 significant figures (decimal) example declaration

      float is smallest decimal type next is double

    1. type conversion function

      int('3') # produces the integer 3
      </prei

    2. modulus operator

      3 % 2 # 1
      </pre

    3. logical operator

      True and False # False
      True or False # True
      </pre

    4. integer division
      3 // 2 # 1
      
    5. literal
      x = 'cat' #x is assigned to the string literal cat
      
    1. someValue = static_cast<int>(Num1 + Num2); // no warning – OK

      casts a double to an integer.

    2. val++; //increment ++val; val--; //decrement --val;

      increment/decrement

    3. static_cast<float>

      this is used to cast a value to another type. since we are casting an integer to float we do not lose any information

    1. float celc; // output variable 15. float fahr; // input variable

      variable declaration

      definition would actually given that variable a value

      celc = 30.5; //definition
      int x = 5; //declaration and definition
      int y; //just declaration
      
    2. 06. #include <iostream>

      include directive which brings in the code from iostream into your program for use

    1. what is an algorithm? I define it as a clear, concise, correct step-by-step sequence of steps to solve a problem

      algorithm should be 1) finite 2) correct 3) efficient

    2. Example 1

      do these examples as much as you can before looking at the solution

    1. Flow of control is often easy to visualize and understand if we draw a flowchart. This flowchart shows the exact steps and logic of how the for statement executes.

      a forloop will alter the control flow

      A
      B
      C
      REPEAT 10 times{
      }
      D
      
      before this program can do D is must repeat 10 times which is altering the sequential flow of the program so that we get a loop. instead of going directly to D, program does something 10 times.

    1. A basic building block of all programs is to be able to repeat some code over and over again.
      1. repeat something n number of times
        for i in range(n):
        #do something
        
      2. do something until some condition
      while <condition>:

      this loops continues until the conidtion evaluates false

      1. looping through a colllection/or sequence
      #looping through string
      s = 'cat'
      for char in s:
      
      #list
      
      animals = ['cat', 'rabbit', 'dog']
      for a in animals:
          print(a)
      

      over the course of this loop character is going to be equal to each individual character in s

    1. ist is a sequential collection of

      lists are mutable. (mutable means subject to change) it means you can mutate the list, add stuff remove stuff etc

    2. parentheses

      1 element tuple must be initaliexed like this

      t = (1,)

    3. [10, 20, 30, 40]

      list literal

    1. assign 71 to a variable that represents current temperature

      this means they want you to create a new variable and set its value to 71. don't over think it, just set the variable to 71 and name the variable temp or something like that.

    1. Suppose that you are playing football on a large field with several friends and one of you discovers that a house key has been lost. Write an algorithm for finding the key that is designed to find it as quickly as possible. Write another algorithm designed to take a long time to find the key. Can you reason whether your algorithms are the best possible or worst possible algorithms for this particular task?

      This is not meant to be written in c++. just use pseudo code or plain english to describe the algorithm

      for example, a horrible algorithm that fails to find solution is this

      function::badFunction() -> key
      
      returns key if key found otherwise returns null
      
      check the spot you are currently standing on the football field
      if key is there then return true 
      otherwise 
        return key is not there
      
    2. 2. Programming Fundamentals 2.0. Algorithms 2.1. C++ Basics 2.2. Variable Declarations 2.3. Reserved Words

      read this before feb 15

    3. In order to fix the flat yourself, you need a lug-wrench, a jack, and an inflated spare tire. If you don't have any one of these, you must call for help. Write a step-by-step description of how you are able to continue your drive.

      basically you got two choices 1) you have all the tools dont need to all for help 2) your missing at least one tool and you need to call for help

  4. Dec 2019
    1. protected member variable or function is similar to a private member but it has the additional benefit that they can be accessed by derived classes.

      In other words, any class inheriting from "LogicGate" will have access to its parents protected members.

    1. if 𝑛nn does not divide 𝑚mm evenly, then the answer is the greatest common divisor of 𝑛nn and the remainder of 𝑚mm divided by 𝑛nn.

      m = 20, n = 10 20 / 10 = 2 CASE 1

      m = 100, n = 70 100 / 70 CASE 2 gcd(100, 100 % 70) =

      gcd(100, 30) gcd(100,30) CASE 2 gcd(100, 100 % 30) =

      gcd(100, 10) 100 / 10 = 10 CASE 1

      gcd(100, 70) = 10

  5. Oct 2019