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.
Printable View
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.
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.
which C/C++ compiler are you using?
ok,I will try to modify my questionQuote:
Originally Posted by Harsh Gupta
Is it possible to print text
without using printf() in C
without using cout in C++
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().Quote:
Originally Posted by sunnypalsingh
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.Quote:
Originally Posted by CornedBee