C++ Language | Solving for Cube Root

Wednesday, 2 January 2013


In mathematics specially in equations in algebra, there are times that square roots and cube roots appear. Square root is the process of multiplying a number by itself. While, cube root is the process of multiplying a number by itself three times to get an answer. Sometimes people tend to confuse these two equations because they sound almost the same.

Thinking about this, I come up with an idea to make a program that can compute for the cube root of a number. This program is used with a float data identifier to allow users enter a number with or without decimal points. Check out the codes below.


   1:  #include <iostream>
   2:  #include <conio.h>
   3:   
   4:  using namespace std;
   5:   
   6:  int main()
   7:  {
   8:      float side = 0.0f;
   9:      float sideCubed = 0.0f;
  10:      cout << "Enter a real number: ";
  11:      cin >> side;

String | A Site Welcome Message


We are all familiar with networking sites, emails and other sites that gives us entertainment over the internet. Before we can access these sites we need to register first to become one of their members and access lots of features you might really like. One thing we observe after registration process is the welcome message we see on the screen bearing our names, like this, "Welcome Reymond Ayala". These welcome notes only mean one thing, we are successfully registered.

I thought of making a program that will look like that welcome note on sites. This program is used with a string command that will basically read all your character inputs. Check out the codes below.


   1:  #include <iostream>
   2:  #include <conio.h>
   3:  #include <string>
   4:   
   5:   
   6:   
   7:  int main()
   8:  {
   9:      std :: string firstName = "";
  10:      std :: string lastName = "";
  11:      std :: cout << "Enter your first name and press Enter: ";
  12:      std :: cin >> firstName;
  13:      std :: cout << std::endl;
  14:      std :: cout << "Enter your last name and press Enter: ";

C++ Language | Basic Calculator


Calculators are made to calculate simple to difficult equations or even just the basic math equations. Addition, Subtraction, Multiplication and Division are the four basic mathematical operation and the foundation in creating equations that are used for calculating specific or certain things. Since kindergarten, we are taught how those operations work with numbers. So, I thought of making a program that can be helpful not just in our daily encounter with mathematics but also in teaching our younger ones about the four basic mathematical operation.

This program is used with a float data type identifier. The difference of float (%f) from int (%d) is that int only accepts whole numbers for input even on outputs. While float accepts numbers with decimal points, also with the outputs. It is also a C++ language code. Check out the codes below.


#include <iostream>
#include <conio.h>

using namespace std;



int main()
{
    float num1 = 0.0f;
    float num2 = 0.0f;
    cout << "Enter a real number n1: ";
    cin >> num1;
    cout << "Enter a real number n2: ";
    cin >> num2;
Related Posts Plugin for WordPress, Blogger...