DEV Community

Analyze_
Analyze_

Posted on

3 3

Cpp Square Root Calculator

I like making calculators so I made one for square root. This uses the cmath package

Link

#include <cmath>
#include <iostream>
using namespace std;

int main() {
  string session = "y";

  while (session == "y") {
    int num = 0;
    cout << "What would you like to find the quare root of?\n";
    cin >> num;
    cout << sqrt(num) << "\nWould you like to continue session [y/n]?\n";
    cin >> session;
    cout << "\x1B[2J\x1B[H";
  } // end of session
  cout << "\x1B[2J\x1B[H";
  cout << "Ended session\n";
  return 1;
} // end of code
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay