From 7dd9080587edce81519459892228d0ff36b3b7de Mon Sep 17 00:00:00 2001 From: Derek Nitsche Date: Thu, 12 Sep 2024 18:31:00 -0700 Subject: [PATCH] added division. Closes #2 --- main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 08dfcf5..50b4548 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,11 @@ int main(){ std::cout<< (first+second) << std::endl; std::cout<< "Subtraction: "<< first << "-" << second << "="; std::cout<< (first-second) << std::endl; - + if (second != 0) { + std::cout<< "Division: "<< first << "/" << second << "="; + std::cout<< (first/second) << std::endl; + } else { + std::cout<< "Division: Cannot divide by zero." << std::endl; + } return 0; -} \ No newline at end of file +}