Jump to content

Introduction to C++ "Hallow World"


cis_academy

Recommended Posts

quote:
Originally posted by Hyestyle:

... give me one way so that might be easier for me as an example.


Here's one of them. I changed the space before 'n' to '-'.

 

code:
int i, n=20;

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

printf("-");


Hint: the second one should also be fairly easiy since it's similar to this one. But the third one is tough I think. Not too many people would be able to do it on their own.

 

quote:
Originally posted by Hyestyle:

How old are you Seaphan?


1A
Link to comment
Share on other sites

quote:
Originally posted by Hyestyle:

Seaphan your code does not work man. Review it.

I run with my compiler it does not work try it again.


Very good. I just did that to see if you are paying attention or not.

 

Here's the real 1-st solution:

 

code:
int i, n=20;

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

printf("-");


change the space before 'i' to '-'.
Link to comment
Share on other sites

Ok Sip I got question for you. First, how old are you? Second, Do you go to Armenian chat and what is your Screen Name? It would be better to talk on the chat cuz this forum is not enough for me lol

 

Who says I am a hacker? Why do you think that you look at my site? LOL I just made something for fun. I like hacking but i aint good at it. Anyway hurry answer this. And what makes you say that I am a hacker?

Link to comment
Share on other sites

HyeStyle Welcome to HyeForum.

 

if you need to know how old Seapanchik is you can go to Start->Run->Calc->view->Scientific->Hex->1A->Dec and the answer will be there.

 

Good luck.

 

[ January 21, 2003, 07:24 PM: Message edited by: Azat ]

Link to comment
Share on other sites

Ok Sip. I did it another way.

 

here it is:

 

code:
  

 

#include

 

void main()

 

{

int i, n=20;

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

printf("-");

 

}


Vopshem we're done with this and the other onoe I don't care. Damn this was pain in the ass.

 

Next, we'll talk about Qbasic

Link to comment
Share on other sites

Ok, that's one way. There are 2 other ways to do it too (3 ways total).

 

Qbasic? QuickBasic? Sure. We can talk about those too. I have to say out of all programming I have done, QuickBasic (4.5) was the most fun. I pretty much learned programming because of that, even though I started on Commodore 64 Basic and also GWBasic on an XT. But Qbasic and QuickBasic really were the first times when I got out of the "spaghetti programming" mode. Are you familiar with the term "spaghetti code"?

 

Oh, and I'm sure Azat will be able to tell us more about how they used to program with rocks and branches in the old days before BASIC

 

But talking about EVERYTHING computers? You trying to ruin my reputation as the somewhat computer savvy cool guy and expose me as the really really really geeky Sip?

Link to comment
Share on other sites

quote:
Originally posted by Sip:

Ok, that's one way. There are 2 other ways to do it too (3 ways total).


Oooops ... actually, no. Sorry. You changed 2 characters there (-- to ++). You can only change 1 character. And there are 3 different ways to do it.
Link to comment
Share on other sites

  • 6 months later...

SIP

 

would this work for the C problem?

 

#include

 

int main()

{

int i, n=-20;

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

printf("-");

}

 

or

 

#include

 

int main()

{

int i, n = 20;

for(i=19; i

printf("-");

}

 

PS: I don't have a compiler right now so I am unsure of the result.

Link to comment
Share on other sites

Sorry ... neither will work.

 

In the first one, i starts at 0 and n is -20. So the loop will never execute since i

 

In the second one, i=19, n=20 and i-- ... that will print a LOT of '-'s because i will be less than n for a long time!

 

Note that in the original problem, you can only change one character. You can't add characters, you can't remove characters, and you can only change one character into another character.

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...