Forked from
Configs / EC327 / Labs / Current
177 commits behind the upstream repository.
-
Ari Trachtenberg authoredAri Trachtenberg authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
LabOne_ChapterFour.h 1.69 KiB
//
// Created by Ari Trachtenberg on 9/10/24.
//
// CHAPTER 4
/**
* @input read in two positive integers, height and width
* @output a height x width rectangle of stars "*"
* @note You may use only *one* loop in your code - no
* nested loops.
*
* @example 1
* height: 3
* width: 4
* ****
* ****
* ****
*
* @example 2
* height: 1
* width: 10
* **********
*/
void labOne_pZero();
/**
* @input max The upper bound of sums
* @output The sum of the following terms:
* a. The sum of the even integers between 2 and max (inclusive).
* b. The sum of all square numbers between 1 and max (inclusive).
* c. The sum of all positive powers of two less than or equal to max.
* @note: You must use *loops* to compute the component sums.
* @see https://en.wikipedia.org/wiki/Square_number
*
* @example 1
* Max: 2
* 5
*
* This is because 2+1+2 = 5:
* a. The sum of even integers between 2 and 2 inclusive (i.e., 2)
* b. The sum of all squares between 1 and 2 (inclusive) (i.e., 1)
* c. The sum of all positive powers of two less than or equal to 2 (i.e., 2)
*
* @example 2
* MaxL 9
* 47
*
* This is because 20+14+13 = 47:
* a. 2+4+6+8 = 20
* b. 1+4+9 = 14
* c. 1+4+8 = 13
*/
void labOne_pOne();
/**
* @input a string
* @output all substrings of the input, sorted by length.
*
* @example
* Input: rum
* Output:
* r
* u
* m
* ru
* um
* rum
*/
void labOne_pTwo();