Jump to content

Computer related puzzles and questions


Sip

Recommended Posts

  • Replies 129
  • Created
  • Last Reply

Top Posters In This Topic

It is ... it is half a byte, i.e 4 bits ... you you have bit, nibble, byte, word (doublet), quadlet (32 bits) etc (octlet).

 

So another trivial yet not so trivial question that only geeks know ... how many bytes in a mega byte?

Link to comment
Share on other sites

I will post my C++ **** Homework and I will allege it is a puzzle then wait Azat or Seaphan answer it, I will copy write my name and I will have my homework compleated.

 

So is it a good idea ?

 

Afterall it is also a puzzle

Link to comment
Share on other sites

Sure why not Domino jan ... Azat and I will write a nice "virus" and tell you it is the solution. You will run it on your computer and it will send us all your secrets!!!

 

Just wait a couple of weeks and they way it is going, Harut is going to be able to do all your homeworks for you

Link to comment
Share on other sites

Technically yes. If it is a program that runs, pretending to do one thing but actually doing another, usually destructive thing, then it is called a Trojan Horse. A virus copies itself and sometimes mutates (changed its own program). But as far as sending information back, any one of those (virus, worm, or trojan) can send info back as far as I know... worm is basically same as a virus ... they used to be classified differently depending on how they existed and "reproduced" but I think the terms are being used interchangably now.
Link to comment
Share on other sites

quote:
Originally posted by MosJan:

what can we use this C++ for ???

 

MOvses


Almost every program you see running on your computer was written in C/C++. The windows/unix/linux operating systems are all written in C/C++. Even C/C++ compilers are written in C/C++!!!!!!!! (the compiler takes a C/C++ souce and makes the executable program that you can run).

 

Harut jan, one down, 2 to go

Link to comment
Share on other sites

quote:
Originally posted by Sip:

Just wait a couple of weeks and they way it is going, Harut is going to be able to do all your homeworks for you smilies/lol.gif


well, if Domino behaves, i might do them.

acctually, it will be benefical for me too.

my prof. is quite popular person in industry (at least he says so).

and he promised me very good reconmendational letter, if i do some extra work.

 

honestly said, i liked this language very much.

it is hard, but still it is charming.

i've got into it so much that i pay very little attantion to my other classes.

Link to comment
Share on other sites

Once you get used to power of C/C++, everything else seems like a toy. In C, you have control over EVERYTHING. Read/Write anything you want from/to any part of the memory ... it also means you could really screw things up if you don't know what you are doing and if you are not carefull (well, these days, worst case your program will crash )
Link to comment
Share on other sites

By the way, Harut I think you are probably ready for the following problem:

 

C/C++ Programming Problem

Please find three ways to change one character in the following code so that the resulting code will print 20 times - (minus sign)Remember : for each solution you can only change one character, and there are three different solutions (yes, space is one character too).

 

code:
int i, n=20;

for(i = 0 ; i < n ; i --)

printf("-");


Basically it says you can't add or delete anything. Just "change" one character (including blanks). The output should be "--------------------" (20 minus signs). It took me a while to figure it out so it is definitely not a

trick question or a joke. It makes you "think" when you see that only changing one character can have such dramatic effects ! Now go and try to debug 1 million lines of code in a real program !!!

Link to comment
Share on other sites

quote:
Originally posted by Harut:

Sip jan, here comes one more.

 

code:
int i, n=20;

for(i = 0 ; i <-n ; i --)

printf("-");


i changed the " " (space) between "<" and "n" to "-".
The third one was correct but this one I don't think will work When you start, i=0. 0<-20 is false so the loop will not execute.

 

2 down, 1 more to go

Link to comment
Share on other sites

O.K I see, my answer is wrong.

 

"can't add or delete anything"

 

and

 

"--------------------"

 

I havent paied any attention to this.

 

[ April 09, 2002, 09:01 AM: Message edited by: Domino ]

Link to comment
Share on other sites

quote:
Originally posted by Sip:

quote:
Originally posted by Harut:

Sip jan, here comes one more.

 

code:
int i, n=20;

for(i = 0 ; i <-n ; i --)

printf("-");


i changed the " " (space) between "<" and "n" to "-".
The third one was correct but this one I don't think will work When you start, i=0. 0<-20 is false so the loop will not execute.

 

2 down, 1 more to go


and just what i was thinking when posting this?

that's right, still one more to go.

Link to comment
Share on other sites

  • 3 weeks later...

Sip, you have to give me the third solution of this, if there is any.

 

this was the problem.

code:
int i, n=20;

for(i = 0 ; i < n ; i --)

printf("-");


those are my two answers.

code:
int i, n=20;

for(i = 0 ;-i < n ; i --)

printf("-");


code:
int i, n=20;

for(i = 0 ; i < n ; n --)

printf("-");


i can't find the third one.

 

or maybe a hint.

 

[ April 25, 2002, 05:54 PM: Message edited by: Harut ]

Link to comment
Share on other sites

ok hint time ... the way "for" works is:

 

for ( expr_1 ; expr_2 ; expr_3 ) ...

 

where expr_1, expr_2, and expr_3 are ANY C++ expression. The first one is usually an assignment to initialize, the second one is a conditional to check for loop termination and the third one is again an assignment of some sort to do the iteration.

 

So now, THINK OUTSIDE THE BOX those expressions can be ANYTHING. Assingment, conditional, function call, arithmetic operation, etc etc ...

 

That's as much as I can say. But this third one is pretty cool to figure out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...