Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (1)

Powered by Vanilla. Made with Bootstrap.
Beginning C++ Variables
  • Xin
    Posts: 3,251
    [hide][---------------------------------------------------]
    Beginning C++ Variables
    Written By Xinapse
    For iExploit.org

    [b]Difficulty:Easy

    [---------------------------------------------------][/b]
    -------[Intro
    If you are familliar to programming, you will know it is essential to know how to use and declare variables. This is very simple, using only a tiny bit of code.
    If you want to use a variable, firstly you will need to declare it, as in C++ the coder must declare it before he can use it. A variable has a type and a name,
    for example
    int mynumber;

    The "int" part declares the variable as an integer - a whole number, "mynumber" is the name that you refer to the variable throughout the program.
    Once you have declared your variable you need to give it a value, you do this by simply writing
    mynumber = 21;

    From now on the variable mynumber has the value 21, this can be used in mathematic functions throughout the program.

    -------[Types of Variables
    int 
    For example 21, this is a simple counting number, either positive or negative.
    short int
    A potentially smaller version of int, uses less memory but with a smaller range.
    long int
    A potentially larger version of int, using more memory, however with gcc there is no difference between int and long int.
    long long int
    An even large version of int, using even more memory.
    float
    A single precision real number eg 1.0F takes less memory than a double but with smaller range and less accuracy.
    double
    A standard floating point variable eg 1.0
    long double
    A larger floating point double, on a pc this is used for the 80x86 floating point processor which is 80bits.
    char
    A single char variable stores a single alphabet or numberic character, but isnt suitable for arithmetic.
    wchar_t
    Same as a char but larger capable or storing other symbols like chinese.
    char string
    A string of characters to form a phrase or sentence eg "Welcome to iExploit"
    bool
    Logical controls such as true and false.

    -------[Simple variable Program
    include <iostream>

    int main()

    {
    using namespace std;
    int mynumber;
    cout << \"What is your number?\" << endl;
    cin >> mynumber;
    cout << \"your number is \" << mynumber;
    }
    return 0;


    Hope you enjoyed this, stay tuned for the next one
    Xin
  • Bursihido
    Posts: 406
    thank you so much :) ..................
  • Xin
    Posts: 3,251
    No problem :) glad you liked it , more coming soon
    Xin
  • chroniccommand
    Posts: 1,389
    Very basic but pretty good.
    TOO FUCKIN SHORT >.>