0

Can we use scanf and printf instead of cout?

15th Feb 2018, 9:11 AM
Mehak Gupta
Mehak Gupta - avatar
3 Antworten
+ 1
yes, you Can because those there are also in cpp, then printf exist also in java scanf("%d",&num); &= using this you pass the address Memory of a variabile, so the function Can insert the blue printf("num = %d \n string = %s", num, string); where %d is for int, %c char, %s string, %f float etc \n = new line
15th Feb 2018, 9:18 AM
Pegasum
Pegasum - avatar
0
sure. But better use scanf_s (if you don't want to use an old compiler) Best thing is to experiment with cout and printf and see what you like more. They both got it's up and downsides. I prefer cout because it has more readability. But I know others who think printf syntax is better to read.
15th Feb 2018, 9:21 AM
Alex
Alex - avatar
0
thnx a lot
15th Feb 2018, 11:59 AM
Mehak Gupta
Mehak Gupta - avatar