|
-
Jan 12th, 2006, 05:50 AM
#1
Thread Starter
Lively Member
Printing text without using printf()
Is it possible to print text without using the printf().If yes can someone please post the code along with meaning's.Thanks in advance.
-
Jan 12th, 2006, 06:04 AM
#2
Re: Printing text without using printf()
In C, puts() or putc(). You could also use fprintf() and pass stdout as the file handle.
In C++, cout.
Look them up, they're simple.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 12th, 2006, 06:10 AM
#3
Re: Printing text without using printf()
which C/C++ compiler are you using?
-
Jan 12th, 2006, 06:16 AM
#4
Thread Starter
Lively Member
Re: Printing text without using printf()
 Originally Posted by Harsh Gupta
which C/C++ compiler are you using?
ok,I will try to modify my question
Is it possible to print text
without using printf() in C
without using cout in C++
-
Jan 12th, 2006, 06:22 AM
#5
Addicted Member
Re: Printing text without using printf()
look hard...answer is already given for C
In case of C++, use cerr though we don't use for this purpose but by default, cerr is same as cout
#Appreciate others by rating good posts !!
#The Software Peter Principle is in operation when unwise developers "improve" and "generalize" the software until they themselves can no longer understand it, then the project slowly dies.
#People who are still ignorant of their ignorance are dangerous.
-
Jan 12th, 2006, 06:30 AM
#6
Thread Starter
Lively Member
Re: Printing text without using printf()
 Originally Posted by sunnypalsingh
look hard...answer is already given for C
In case of C++, use cerr though we don't use for this purpose but by default, cerr is same as cout
sorry I knew that the answer was out for C.But can we print numbers using putc() or puts().
-
Jan 12th, 2006, 06:34 AM
#7
Re: Printing text without using printf()
Yes, but you have to convert them manually first. And the standard C way of converting a number to a string is sprintf (snprintf in C99); in C++ it's a stringstream.
May I ask why you want to know?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 12th, 2006, 06:45 AM
#8
Thread Starter
Lively Member
Re: Printing text without using printf()
 Originally Posted by CornedBee
Yes, but you have to convert them manually first. And the standard C way of converting a number to a string is sprintf (snprintf in C99); in C++ it's a stringstream.
May I ask why you want to know?
Im sorry that I didnt tell earlier.Im a 3rd year Engineering Student preparing for my campus interview,so Im trying to learn some of the stuff they ask and the answers for them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|