i teach a high school c++ course. i would like to use a window for user interface instead of dos console.

could anyone provide me the basic code to display "hello world" in a window?

and if possible a link to the code necessary to use window api for c++ programs.

thank you.
Mike

Recommended Answers

All 7 Replies

>could anyone provide me the basic code to display "hello world" in a window?
Does your compiler offer to do this for you?

[IMG]http://img175.echo.cx/img175/5527/hello4nk.th.jpg[/IMG]

>and if possible a link to the code necessary to use window api for c++ programs.
Have you checked your compiler's documentation? It should be the first source for what it can do.

Could you tell us which compiler you are using?

>i would like to use a window for user interface instead of dos console.
My first question is "why"? Introducing graphics should be done only after the students have a strong foundation in the core language and standard libraries. Otherwise, they'll find themselves battling C++ as well as whatever graphics API you choose to give them.

Then of course there's the argument that if you don't teach the core skills of programming first, then all your students will be able to do is make pretty windows that do nothing useful. And that's a best case situation. If they get discouraged and quit because they never won the "little" battles on the command line and gained confidence then you won't even see pretty windows that do nothing.

Personally, I think you're trying to do too much, too fast. Especially for a high school course. But if you really want to make learning harder (maybe to weed out anyone who doesn't have a passion for programming) then tell us your compiler and we'll be able to make better suggestions.

Try googling for Allegro or SDL for a generic solution.

Using C++ for Windows GUI programming is mildly complex. Just look over some of the DaniWeb C++ code snippets and judge for yourself. I can imagine that some of your beginning students would be overwhelmed.

>could anyone provide me the basic code to display "hello world" in a window?
Does your compiler offer to do this for you?

[IMG]http://img175.echo.cx/img175/5527/hello4nk.th.jpg[/IMG]

>and if possible a link to the code necessary to use window api for c++ programs.
Have you checked your compiler's documentation? It should be the first source for what it can do.

Could you tell us which compiler you are using?

Compiler is Visual C++ 6.0

>i would like to use a window for user interface instead of dos console.
My first question is "why"? Introducing graphics should be done only after the students have a strong foundation in the core language and standard libraries. Otherwise, they'll find themselves battling C++ as well as whatever graphics API you choose to give them.

Then of course there's the argument that if you don't teach the core skills of programming first, then all your students will be able to do is make pretty windows that do nothing useful. And that's a best case situation. If they get discouraged and quit because they never won the "little" battles on the command line and gained confidence then you won't even see pretty windows that do nothing.

Personally, I think you're trying to do too much, too fast. Especially for a high school course. But if you really want to make learning harder (maybe to weed out anyone who doesn't have a passion for programming) then tell us your compiler and we'll be able to make better suggestions.

Try googling for Allegro or SDL for a generic solution.

All valid points, however, with the length of the course it may be a good alternative lesson to take a break from the grind...HS students need more stimulation than hardcore programmers:)

Compiler is Visual C++ 6.0

So is that picture.

>HS students need more stimulation than hardcore programmers
Then perhaps you should teach a language better suited for students than C++. Java perhaps, or Python. Both have relatively easy to use graphics APIs available right out of the box. C++ is a hardcore language designed for hardcore programmers. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.