COME ON CODE ON

A blog about programming and more programming.

Archive for the ‘Uncategorized’ Category

Just Another Question

with 7 comments

Here’s an interesting Question :
Look at the following code. Its to print ‘*’ 20 times.

#include<iostream>
using namespace std;  
int main()
{
    int i,n=20;
    for (i=0;i<n;i--)
        cout<<"*";
    return 0;
}

Obviously the code above is wrong. You have to find three ways of correcting the program either by replacing a single character in the code with another character or adding a single character to the given code.
Try it. It’s fun.

Answer 1: Change i<n to -i<n
Answer 2: Change i- – to n- -
Answer 3: Change i<n to i+n

Credit for this question goes to my roommate who gave me this(though he too got it from somewhere else).

-fR0D

Written by fR0DDY

March 5, 2009 at 6:09 AM

Posted in Uncategorized

Tagged with ,

My Digital Signature

with 6 comments

One day while surfing i reached this page. After looking at the quote there i thought why not create one for myself. So i set on to make my signature but it wasn’t easy. I learned new things while making it though. Anyways here’s my digital signature :

double m[]={4910923072864513.0,819};
main(){1[m]--?*m*=2.,main():printf((char*)m);}

This was a learning process which started with this :

long long x=94838554181959LL;int main(){printf((char*)&x);}

went on to this :

int x=5570631,y=5636178,f=1;
main(){f?f^=f,x+=(65<<8),printf((char*)&x),main():
 (y+=(65<<8),printf((char*)&y));}

And finally reached my digital signature above. Hope to create an even more complex one when i am free next time. Again you need to compile them using gcc, g++ won’t work.

-fR0D

 

Written by fR0DDY

February 11, 2009 at 4:48 PM

Posted in Uncategorized

“Hello World!”

leave a comment »

Hi everyone,

I am Gaurav.I am a junior undergraduate at IT-BHU with keen interest in computers specially programming and maths.

Through this blog i wish to write mainly on technical stuffs but often my thoughts about life and other things may creep in.

So hang On! And Happy Coding!
-fR0D

Written by fR0DDY

February 9, 2009 at 8:20 AM

Posted in Uncategorized

Follow

Get every new post delivered to your Inbox.

Join 99 other followers