Sunday, June 12, 2016

Square Root and Absolute Value in C++

A square root and absolute value in C++ program that I wrote a long time ago in my programming class in college. The code is very easy to understand and learn for beginners that are new in C++ programming.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <math.h>

using namespace std;

class square_root {
    public:
    int value;

};


main() {
     square_root number;

      cout << "\t\t Square Root and Absolute Value Solver 1.0 ";
      cout << "\n\n";
      cout << "Enter A Number : ";
      cin >> number.value;
      cout << "\n\n";
      cout << "The Square Root Value of "
           << number.value << " is " << sqrt(number.value) << ".";
      cout << "\n";
      cout << "The Absolute Value of "
           << -number.value << " is " << abs(number.value) << ".";
      cout << "\n\n";
      system("pause");
}


No comments:

Post a Comment