944,028 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4570
  • C++ RSS
Oct 31st, 2005
0

How to print

Expand Post »
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[])
{

cout<<"hello";
Return_0;
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tdizzle342 is offline Offline
19 posts
since Oct 2005
Oct 31st, 2005
0

Re: How to print

Something similar to this?
C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. cout << "Press [enter] to continue...";
  7. cin.get();
  8. cout << "Hello\n";
  9. return 0;
  10. }
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Nov 1st, 2005
0

Re: How to print

Ya but how do i get it to print hello on paper.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tdizzle342 is offline Offline
19 posts
since Oct 2005
Nov 1st, 2005
0

Re: How to print

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Nov 1st, 2005
0

Re: How to print

Narue,
What are you talking about professors know everything.......
Reputation Points: 14
Solved Threads: 4
Junior Poster
prog-bman is offline Offline
108 posts
since Nov 2004
Nov 1st, 2005
0

Re: How to print

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!
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Nov 2nd, 2005
0

Re: How to print

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.)
Reputation Points: 23
Solved Threads: 23
Posting Pro in Training
Puckdropper is offline Offline
494 posts
since Jul 2004
Nov 6th, 2005
0

Re: How to print

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tdizzle342 is offline Offline
19 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Open Source Projects
Next Thread in C++ Forum Timeline: conway's game of life





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC