+ 6
You can use them both, but for cout you need to use "<<" manipulator, and for printf you need to use formatter string. It looks like that: printf("Hello %s\n%c", "World", '!'); /*outputs "Hello World !" */ %s and %c - formatters, at first program outputs all before '%' symbol, %s says that you need to output string next (in params), when string is outputed then program returns to format string and outputs all until '%' symbol, and %c says that you need to output character (also in params). You can read more about formatters in the Internet, just google it. Formatters also can be composite, like %lc (long character) or %.8f (outputs up to 8 nums after floating point in float or double nums). Hope, I helped you. And sorry for bad english.
6th Nov 2016, 9:32 AM
Bivian
Bivian - avatar
+ 1
no problem, use #include <iostream> #include <stdio.h> using namespace std; int main() { printf("hello world"); return 0; }
5th Nov 2016, 3:47 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
Yeah, they just use a different library. <iostream> is standard library for C++ and handles input and output so cout, cin, etc. <stdio.h> is standard C library and also handles input and output as you get printf, scanf, etc..
5th Nov 2016, 7:09 PM
Jaque
Jaque - avatar
+ 1
Yeah I read it on My aunt's book about C. There was #include<stdio.h>. But It was on C language.
6th Nov 2016, 6:45 AM
Mashrafe
Mashrafe - avatar