Whats the difference? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Whats the difference?

#include "stdio.h" #include <iostream> using namespace std; void main() { printf("Hi\n"); cout<<"Its a test"<<endl; return 0; } what's the difference between printf and cout? both of them prints statement....

5th Jan 2017, 5:14 PM
DEF4LT_
DEF4LT_ - avatar
2 Réponses
+ 3
printf and cout are both used for displaying. printf is used in C. and cout is used in c++. since c++ is developed based on C, printf is also supported in c++
5th Jan 2017, 6:02 PM
Arlesh Maharjan
Arlesh Maharjan - avatar
+ 2
Printf is a method which uses cout. It's just meant to give an easier syntax for printing, since it automatically adds the -cout <<- and -<< endl- parts. Printf is used in C, while cout is used in C++.
5th Jan 2017, 5:40 PM
Dao
Dao - avatar