14th Aug 2017, 9:28 AM
Emrul Hasan Emon
Emrul Hasan Emon - avatar
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
14th Aug 2017, 12:48 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 7
@Shobhit, actually I don't have idea about turbo, Ace's thread suggested by Baptiste may help you :)
14th Aug 2017, 3:15 PM
Shamima Yasmin
Shamima Yasmin - avatar
14th Aug 2017, 3:10 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
thnx @shamima actually it was on school's computer so i have to use it there. thnx again
14th Aug 2017, 4:11 PM
shobhit
shobhit - avatar
+ 1
printf is used to print anything to the console in c.
14th Aug 2017, 9:36 AM
shobhit
shobhit - avatar
+ 1
Can't I use ut in C++?
14th Aug 2017, 10:59 AM
Emrul Hasan Emon
Emrul Hasan Emon - avatar
+ 1
no use cout instead.
14th Aug 2017, 11:24 AM
shobhit
shobhit - avatar
+ 1
If I use it what type of prblm will arise?
14th Aug 2017, 11:27 AM
Emrul Hasan Emon
Emrul Hasan Emon - avatar
+ 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
14th Aug 2017, 11:39 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
I see...thanks for the advise
14th Aug 2017, 12:23 PM
Emrul Hasan Emon
Emrul Hasan Emon - avatar
+ 1
I got it 😊
14th Aug 2017, 12:59 PM
Emrul Hasan Emon
Emrul Hasan Emon - avatar
+ 1
but @shamima i have tried it today in turbo c7 and it was not working. is it due to turbo or something else.
14th Aug 2017, 2:04 PM
shobhit
shobhit - avatar
+ 1
okh
14th Aug 2017, 3:02 PM
Emrul Hasan Emon
Emrul Hasan Emon - avatar
+ 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.
14th Aug 2017, 4:53 PM
Soluchan
Soluchan - avatar
+ 1
okh
14th Aug 2017, 4:54 PM
Emrul Hasan Emon
Emrul Hasan Emon - avatar