+ 1
I wanna know thee use of printf
15 Answers
+ 9
It's not a good practice to use printf in C++. But if you need, it can be used by including the library stdio.h
https://code.sololearn.com/c9eup96H851e/?ref=app
+ 7
@Shobhit, actually I don't have idea about turbo, Ace's thread suggested by Baptiste may help you :)
+ 3
thnx @shamima actually it was on school's computer so i have to use it there. thnx again
+ 1
printf is used to print anything to the console in c.
+ 1
Can't I use ut in C++?
+ 1
no use cout instead.
+ 1
If I use it what type of prblm will arise?
+ 1
No problem will arise if you use it like in C. It is just bad practice in C++ as you have a more useful and secure tool which is cout
+ 1
I see...thanks for the advise
+ 1
I got it đ
+ 1
but @shamima i have tried it today in turbo c7 and it was not working. is it due to turbo or something else.
+ 1
okh
+ 1
any c program can be a c++ program and you don't have to include <iostream> to it. cause it will work without and sometimes printf is more suitable and convenient to use then cout.
ex:-
int x = 1, y = 2;
cout << "Array of a[" << x << "][" << y << "] ;" << endl;
printf( " Array of a[%d][%d] ;\n" , x, y);
output = Array of a[1][2] ;
as you see output is same but syntax are different.
+ 1
okh