Friday, May 31, 2013

C++ a history and overview

C++ actually stands for Classes plus plus. C which stands for classes did not provide enough for the growing needs of programmers. Thus C++ was born. It was created by the same person who created C. His name was Bjarne Stroustrup. He was a danish computer scientist. C++ is good for userspace applications. However, C is far better for kernels. C++ hides many of the many memory routines that a kernel would use. C++ is also very simple compared to C. C and C++ are both compiled languages. They can be directly run by the systems CPU. Common compilers for these languages include MS visual studio and personal favorite, albeit a toolchain, GCC. C++ files end in ".cpp" or ".h". IDE's are used to make the development of programs more efficient IDE stands for integrated development environment.
Below I offer some example code that wrote:

Setting up your build environment:
On Ubuntu: $ sudo apt-get install build-essential codeblocks
On redhat: $ sudo yum install codeblocks gcc
On Archlinux: $ sudo pacman -S codeblocks gcc
On Windows: Download and install: Code::Blocks
Resources, references and tutorials:
File IO:
Online Compiler:
Learn C++:
Creator of C++ HomePage:

Code snippets:

My program for solving the quadratic formula:
#include <iostream>
#include "Quad.h"
double x,y,z; // variable x = 'a', variable y = 'b' and variable z = 'c'.
int main()
    std::cout << ("Enter the value for 'a': ");
    std::cin >> x;
    std::cout << ("Enter the value for 'b': ");
    std::cin >> y;
    std::cout << ("Enter the value for 'c': ");
    std::cin >> z;
    std::cout << ('\n') << (Quad(x,y,z).first) << ('|') << (Quad(x,y,z).second) << std::endl;
    return 0;
inline std::pair< std::complex, std::complex > Quad(double a, double b, double c)
    std::complex  square = (b*b * -4*(a*c));
    return {(-b + std::sqrt(square)/(2*a)), (-b - std::sqrt(square)/(2*a))};