Results 1 to 5 of 5

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User rumen_33's Avatar
    Join Date: May:2007
    Location: Canada
    Posts: 137

    Matrix program C++ -

    , - , . . :

    #include <cstdlib>
    #include <iostream>
    #include <windows.h>

    using namespace std;

    void setcolour(unsigned short colour)
    {
    HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hcon,colour);
    }

    void gotoxy( short x, short y )
    { //Bottom right corner is (79,24)
    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD position = { x, y };
    SetConsoleCursorPosition( hStdout, position );
    }

    class Icon
    {
    private:
    int color;
    int x;
    int y;
    char symbol;
    bool active;

    public:
    // Constructor
    Icon()
    {
    int randNumber = rand()% 10 + 1;
    if (randNumber > 0 && randNumber < 7)
    color = 2;
    else
    color = 10;
    y = 0;
    }

    // Setter for x
    void setx (int newx)
    {
    x = newx;
    }

    // getter for x
    int getx ()
    {
    return x;
    }

    void activate ()
    {
    active = true;
    }

    void deactivate ()
    {
    active = false;
    }

    void printsymbol()
    {
    gotoxy(x,y);
    cout <<symbol;
    }

    // Filling an array
    char symbolArray [1896];
    void insert (char symbolArray[])
    {
    for (int x = 0; x < 1896; x++)
    {
    symbolArray[x] = char (rand()%1000 + 1);
    }
    }

    void updatechar ()
    {
    int newsymbol = rand()%1000 + 1;

    symbol = newsymbol;
    cout <<newsymbol;
    }
    };


    int main()
    {

    Icon obj;
    obj.printsymbol();
    cout <<endl;

    system("PAUSE");
    return EXIT_SUCCESS;
    }

    !
    Last edited by rumen_33; 8th December 2008 at 21:09.
    |Asus P5K Premium WiFi|Intel C2D E6750|Kingston 2x1GB@667MHz|Seagate 250GB+500GB|Coolmax CP 500W|Asus EN 8800 GTS 320MB|

  2. #2
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    ? // ?

  3. #3
    Registered User rumen_33's Avatar
    Join Date: May:2007
    Location: Canada
    Posts: 137
    , 'x' . , .
    |Asus P5K Premium WiFi|Intel C2D E6750|Kingston 2x1GB@667MHz|Seagate 250GB+500GB|Coolmax CP 500W|Asus EN 8800 GTS 320MB|

  4. #4
    Registered User
    Join Date: Apr:2004
    Location: EU
    Posts: 141
    x, y symbol.

  5. #5
    Defender Kaspirtov's Avatar
    Join Date: Jun:2006
    Location: Sf
    Posts: 7,414
    Quote Originally Posted by rumen_33 View Post
    , 'x' . , .
    ?! - ?! . , ESC, .
    " , , , , ."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |