954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to print

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
#include
#include

using namespace std;

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

cout<<"hello";
Return_0;

tdizzle342
Newbie Poster
19 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

Something similar to this?

#include <iostream>
using namespace std;

int main()
{
   cout << "Press [enter] to continue...";
   cin.get();
   cout << "Hello\n";
   return 0;
}
Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

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

tdizzle342
Newbie Poster
19 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

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

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

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

prog-bman
Junior Poster
109 posts since Nov 2004
Reputation Points: 14
Solved Threads: 4
 

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

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

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

Puckdropper
Posting Pro
500 posts since Jul 2004
Reputation Points: 23
Solved Threads: 23
 

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

tdizzle342
Newbie Poster
19 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You