Patrunjel's Profile User Rating: -----

Reputation: 17 Tradesman
Group:
Contributors
Active Posts:
298 (0.32 per day)
Joined:
28-October 10
Profile Views:
3,941
Last Active:
User is offline Jul 15 2012 01:56 PM
Currently:
Offline

Previous Fields

Country:
RO
OS Preference:
Linux
Favorite Browser:
Mozilla
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
50

Latest Visitors

Icon   Patrunjel has not set their status

Posts I've Made

  1. In Topic: Pointer question

    Posted 4 Dec 2011

    From what I know, C needs to know exactly where it's pointing to, and to what data type, and so on, so I don't think it's possible.

    LE: Sorry, I was on the page scince the first post, but got into C::B to test something (related to the answer) and didn't see Hezekiah's reply.
  2. In Topic: How to define a square?

    Posted 1 Dec 2011

    Thanks :)

    Scumbag brain. Thinks of a solution that involves three different situations, requires two additional functions to be written, needs another library to be added, and has three if statements with 3 nested parentheses, but ommits what a square actually is...

    LE: Your solution works only if two sides of the rectangle are parallel to one of the reference axis.
    Following this idea, the best thing I can think of (that works for a general square) involves two cases, but it's still simpler than my solution (and faster, because you now only have to subtract stuff (so you can get the x-y variation of two points on one side, value that should be constant).
  3. In Topic: Count to a million

    Posted 26 Nov 2011

    I'd love to take part in a 3530-some (although, I think it would be really crowded)
  4. In Topic: How to make console wider?

    Posted 26 Nov 2011

    If I made the post, I could at least make it useful (and share the awesomeness of computation, so here is the code (the variables, comments and everything is in romanian, just compile it)
    #include<iostream>
    using namespace std;
    
    bool a[4097][4097];
    struct matrice{
        int x,y,l;
    };
    
    void divimp(matrice m){
        if(m.l==2){
            a[m.y][m.x]=1;
        }
        else{
            matrice m1,m2,m3,m4;
            //stabilesc m1(stanga-sus)
            m1.x=m.x;
            m1.y=m.y;
            m1.l=m.l/2;
            //stabilesc m2(stanga-jos)
            m2.y=m.y-m1.l;
            m2.x=m.x;
            m2.l=m1.l;
            //stabilesc m3(dreapta-sus)
            m3.y=m1.y;
            m3.l=m1.l;
            m3.x=m.x+m3.l;
            //stabilesc m4(dreapta-jos)
            m4.x=m3.x;
            m4.y=m2.y;
            m4.l=m1.l;
            /*Transform 0-urile in 1 in m1*/
            for(int i=0;i<m1.l;i++)
                for(int j=0;j<m1.l;j++){
                    a[m1.y-i][m1.x+j]=1;
                }
            divimp(m2);divimp(m3);divimp(m4);divimp(m1);
        }
    }
    
    int main(){
        int n,i,j;
        matrice mat;
        cout<<"n=";cin>>n;
        mat.x=1;mat.y=n;mat.l=n;
        divimp(mat);
        for(i=mat.l;i>0;i--){
            for(j=1;j<=mat.l;j++)
                cout<<a[i][j];
            cout<<endl;
        }
        return 0;
    }
    
    

    You just have to give n values that look like this :2^k, whatever k is (an integer). For example, n=2;n=4;n=8;n=16;n=32.
    For values larger that 128 (like 4096, that I'm waiting now to compute :D) you compile and run, and right-click on the blue bar above the actual console, and click properties. From there you go to the "Font" tab and choose the smallest one, then you go to "Layout". There you will have to experiment with the Window Size values so that it will fit your monitor. Also, on the "Layout" tab,(and this is the most important, if you want to see all the shape!)set both the buffer size values to 5000 (you don't use all of it if you give n the value 4096, but your PC will probably take it without complaint). Then just click OK twice and done.

    Now, awesome things that you should know: You have in front of you n*n 1s and 0s (for 4096 that's 16,777,216 digits!), and you will see triangles of k distinct sizes (k from the n=2^k input condition mentioned above). Again, for 4096 that's 10 triangle sizes.Also, if you would store the result of n=4096 in a text file, considering that you declared the array as an int (4bytes/int), the file will be 67,108,864 bytes large. (that's 64mb of 1s and 0s!). Also, the whole thing took approx 400seconds to be generated, on my computer. (only a fraction of that time, 0.422s was needed to actually compute the 4096x4096 array, the rest was used to put the information on the screen.) Computers are awesome!

    So, go on, enjoy the power of fractals!
  5. In Topic: rand() not being rand(om), having trouble pinning down the failure.

    Posted 25 Nov 2011

    You confused the variables that you output if the player chooses a dice with more than 6 faces. For example you have (I couldn't help but add the brackets :D )
    case 4:{
    				cout << "Your twelve sided die has been rolled!";
    				SixSidedDie = (RandomNumber % 12) + 1;
    				cout << TwelveSidedDie << "is what you've rolled" <<endl;
    				system("pause");
    				break;}
    
    

    and it should be
     case 4:{
    				cout << "Your twelve sided die has been rolled!";
    				TwelveSidedDie = (RandomNumber % 12) + 1;
    				cout << TwelveSidedDie << "is what you've rolled" <<endl;
    				system("pause");
    				break;}
    
    

    See line 3, then line 4.

My Information

Member Title:
D.I.C Regular
Age:
18 years old
Birthday:
May 23, 1994
Gender:
Location:
Romania
Interests:
Algorithmics, C++, lately game-developing and network programming and, when i will get time, linux :)
Years Programming:
0
Programming Languages:
C++

Contact Information

E-mail:
Private
Yahoo:
Yahoo  Nytza_Yoz@yahoo.com

Friends

Comments

Page 1 of 1
  1. Photo

    oscode Icon

    20 Jul 2011 - 06:47
    How are you doing Patrunjel? I hope the contest(s) went well.
  2. Photo

    Patrunjel Icon

    18 May 2011 - 10:47
    Hello.
    Yes I am (for one more week :) ). Why are you asking?
  3. Photo

    aine Icon

    15 May 2011 - 06:12
    hi! r u really 16 years old
Page 1 of 1