Jump to content

Need To Create Hello Worlds with Keyboard/Mouse Input

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
8 replies to this topic

#1
MiG-33 SuperFulcrum

MiG-33 SuperFulcrum

    Newbie

  • Members
  • Pip
  • 4 posts
I need some help creating Hello World programs in several languages which will read input from my keyboard/mouse and print Hello World.

The languages I need help with are:
-Fortran
-C++
-php
-JavaScript
-Python
-Perl
-Flaming Thunder

As an example, I wrote one in C# where a Windows form pops up and has two buttons, one of which displays "Hello World" as a label when clicked, and the other exits the program. That's the kind of thing I need--either a message on mouse click or keyboard input. Nothing too fancy.

I would greatly appreciate help on this.

#2
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts
Well some of those languages are scripting languages, so you don't actually create the GUI's with them, you use HTML forms as the buttons. Is that what you are stuck on?

Also creating a GUI in C++ is not quite as simple as that either. You would need some API software. Unless you are able to create this in the console with a "Print Hello World - Y/N" option or something!

Is it the actual syntax in each language you are stuck on? Or how best to make the GUIs?

#3
MiG-33 SuperFulcrum

MiG-33 SuperFulcrum

    Newbie

  • Members
  • Pip
  • 4 posts
I guess I don't really need GUIs - just some interaction with the keyboard or mouse.

I can print Hello World in all of them--I just need a little more than that.

Not sure if that answers your questions...

#4
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts

MiG-33 SuperFulcrum said:

I guess I don't really need GUIs - just some interaction with the keyboard or mouse.

I can print Hello World in all of them--I just need a little more than that.

Not sure if that answers your questions...

Ok, well if you know the basic syntax in all of them, then start to try and write some conditions around it, and if you get stuck in any of them, post what you have here. :)

Note: For C++ you can evaluate the user input in the console by comparing what they have entered against what you want them to enter (IE Y/N).

Hope this helps you.

#5
MiG-33 SuperFulcrum

MiG-33 SuperFulcrum

    Newbie

  • Members
  • Pip
  • 4 posts
Ha, that's the problem: I'm pretty much a noob. I know enough Java and C# to do this sort of thing, but I don't have much experience. I can do it in php I bet, but the other I'm stuck on.

I'll get back to you. Thanks.

#6
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
For each language:
1) print a question "Do you want me to say hello? (Y/N)"
2) get a response
3) if the response is "Y" or "y", print "hello world."
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#7
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts

WingedPanther said:

For each language:
1) print a question "Do you want me to say hello? (Y/N)"
2) get a response
3) if the response is "Y" or "y", print "hello world."

That's exactly the pseudo code to use. Then just use simple conditional statements in each language, and to be honest - they are all pretty similar.

#8
MiG-33 SuperFulcrum

MiG-33 SuperFulcrum

    Newbie

  • Members
  • Pip
  • 4 posts
Ok, if someone could help me with one of those languages, maybe I could do the rest.

How would I make that in Python?

#9
Lassar

Lassar

    Learning Programmer

  • Members
  • PipPipPip
  • 58 posts

MiG-33 SuperFulcrum said:

I need some help creating Hello World programs in several languages which will read input from my keyboard/mouse and print Hello World.
...
I would greatly appreciate help on this.

FreeBasic is perfect for this. Nice and simple.


PRINT "Hello world"

INPUT "What is your name ? ", YourName$

PRINT

PRINT "Hello ";YourName$

SLEEP

END 



-
Cole manager: You have 95 minutes to take the FCC GROL test.
Student: How many lifelines do we get ?