/lab3

Primary LanguageC++

eecs230 lab3

Are there any quick questions about homework or lecture material?


Vectors review

  1. Class example: create a program that converts feet to centimeters, which allows for multiple numbers to be input in one line.
  2. Write a program that can detect whether or not the inputted word is a word you don't like, and if it is, it will "bleep" out the word when it prints/returns.

Functions review

  1. What does "char foo(int x)" mean?
  2. Create a quadratic equation solver program from scratch that can be called by other functions and is readable, simple, clean, and efficient. Detect whether or not the roots will be real or imaginary BEFORE computation and report an error if imaginary.

Error/debugging review

  1. What needs to be try-catch for the previous functions? What errors should be thrown?
  2. Why is (with a vector named v) v[v.size()] a range error?
  3. Correct the following code:
double ctok(double c)
{
    int k = c + 273.15;
    return int
}

int main()
{
    double c = 0;
    cin >> d;
    double k = ctok("c");
    Cout << k << '/n';
}