Difference from cout to printf in C ++

4

I want to know what difference I use in C ++ cout and printf , is it all the same?

    
asked by anonymous 11.05.2017 / 22:59

2 answers

4

No, they are completely different, although they have more or less similar purposes.

cout works with streams of data. These streams can be customized for each data type.

The function printf() is a very simple normal function originally created for C language and has been retained for reasons of compatibility and because in some cases it may be more appropriate than cout .

Generally, cout is not only more convenient and simple to use in C ++, but it also tends to perform better. You have a inbound partner question .

See more about cout here .

And how does printf() work.

    
11.05.2017 / 23:11
-2
#include <stdio.h>
#include <iostream>
int main(){
    printf("Eu posso misturar printf com cout?");
    cout<<"Em?";
    return 0;
}
    
04.05.2018 / 19:15