installer/coursework/Lab 5: Fixes
authorJerome St-Louis <jerome@ecere.com>
Fri, 20 Jun 2014 21:08:23 +0000 (17:08 -0400)
committerJerome St-Louis <jerome@ecere.com>
Fri, 20 Jun 2014 21:10:05 +0000 (17:10 -0400)
installer/coursework/Chapter 5 - Structures and Enumerations/Lab5/colors/lab5colors.ec
installer/coursework/Chapter 5 - Structures and Enumerations/Lab5/vectors/lab5vectors.ec

index c5d53c4..bb93d39 100644 (file)
@@ -39,7 +39,7 @@ KnownColor GetOperand()
    gets(input);
    while(!operand.OnGetDataFromString(input))
    {
-      Print("Please enter a known color (black, red, green, blue, yellow, magenta, cyan or white)");
+      PrintLn("Please enter a known color (black, red, green, blue, yellow, magenta, cyan or white)");
       gets(input);
    }
    return operand;
@@ -50,8 +50,9 @@ KnownColor ComputeOperation(char operation, KnownColor operand1, KnownColor oper
    switch(operation)
    {
       case '+': return operand1 + operand2;
-      case '-': return operand1 - operand2;
+      case '-': return (KnownColor)(operand1 - operand2);
    }
+   return 0;
 }
 
 class Lab5ColorsApp : Application
index 157e8ec..03aa350 100644 (file)
@@ -90,7 +90,7 @@ class Lab5VectorApp : Application
                case '-': PrintLn(vector1, " - ", vector2, " = ", Vector { vector1.x - vector2.x, vector1.y - vector2.y }); break;
                case '*': PrintLn(vector1, " * ", scalar, " = ", Vector { vector1.x * scalar, vector1.y * scalar }); break;
                case '/': PrintLn(vector1, " / ", scalar, " = ", Vector { vector1.x / scalar, vector1.y / scalar }); break;
-               case 'm': PrintLn("|",vector1,"| = ", sqrt(vector1.x * vector1.x + vector2.y * vector2.y)); break;
+               case 'm': PrintLn("|",vector1,"| = ", sqrt(vector1.x * vector1.x + vector1.y * vector1.y)); break;
             }
          }
       }