1. [C++] Effetto Matrix

    Tags
    c
    cpp
    By Saffo´ il 16 Mar. 2013
     
    0 Comments   1,398 Views
    .
    Oggi mi sono divertito a creare un codice che ripetesse una stringa nello stile Matrix. Ho usato C++ ma ho riscritto lo stesso codice anche in C (sì, oggi avevo tempo da buttare xD)

    Ma veniamo al codice...

    CODICE
    #include <iostream>
    #include <stdlib.h>

    using namespace std;

    int main(int argc, char *argv[])
    {
    string rpString = "011010"; // Stringa da ripetere
    int k = 1;
    int rp = 2000; // Numero di ripetizioni
    system ("color 0a");
    while ( k != rp ) {
    k += 1;
    cout << rpString << " ";
    _sleep (5);
    }
    system("CLS");
    system("PAUSE");
    return 0;
    }


    oppure in C
    CODICE
    #include <stdio.h>

    int main()
    {
    char* rpString = "011010"; // Stringa da ripetere
    int k = 1;
    int rp = 2000; // Numero di ripetizioni
    system ("color 0a");
    while ( k != rp ) {
    k += 1;
    printf("%­s ", rpString);
    _sleep (5);
    }
    system("CLS");
    system("PAUSE");
    return 0;
    }
      Share  
     
    .