am new in programming and i need your help.after writting a code if i compile and run the console will not display the output but rather shows and go immediately

This is a common problem. The easiest solution is to place an input request just before the point at which your program terminates. For example:

#include <iostream>

int main()
{
    // Do something
    std::cout << "Hello, world!\n";

    // Pause for input
    std::cin.get();

    // Program terminates here
}

There are cases where that won't work, particularly if previous input from your program is still left in the input stream. You can use a magic incantation in that case and learn how it works later:

#include <ios>
#include <iostream>
#include <limits>

int main()
{
    // Do something
    std::cout << "Hello, world!\n";

    // Clear extranous input
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

    // Pause for input
    std::cin.get();

    // Program terminates here
}

Of course, if there's no leftover input, you'll have to hit the [Enter] key twice because cin.ignore blocks for input too.