Can someone help me, I've been trying forever and still can't get it. I need to get my C++ program to print in dos enviroment. I need it to print the words "Hello" when i push something and nothing else.

#include <cstdlib>
#include <iostream>
#include <conio.h>

using namespace std;

int main(int argc, char *argv[])


Recommended Answers

All 7 Replies

Something similar to this?

#include <iostream>
using namespace std;

int main()
   cout << "Press [enter] to continue...";
   cout << "Hello\n";
   return 0;

Ya but how do i get it to print hello on paper.

>Ya but how do i get it to print hello on paper.
Start by being more specific about your compiler and OS. To do it "right" is a lot of work, but most of the time you can do it pretty easily with a compiler/system-specific solution.

What are you talking about professors know everything.......

If you have Windows and Dev-C++ then you are in luck. Look at the code snippet:
This might be a little overkill since it allows you to set the font, wordwrap and more. Trim it back to what you need!

In DOS, I'd consider issuing:
ctty lpt1

(Warning! This may be written incorrectly. It's been a while.)

Then, everything would print out at the printer connected to the parallel port. (Great for a paper log of a process.)

Thanks guys , and thanks for that huge ass code on how to print, im still new at c++ and that code didnt really help too too much but i really appreaciate it guys. Thanks

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.