+ 1

Help me with this

when we print sum in c program we do it like printf{"sum is %d",sum}; how to do the same in c++

9th Jul 2017, 2:46 PM
Abhishek Powar
Abhishek Powar - avatar
3 Answers
+ 2
If you like C syntax you can include stdio.h or cstdio as well If you are asking for C++ style there are iostream std object cout for output and cin for input. #include <stdio.h> #include <iostream> using namespace std; ... printf("sum is %d", sum); cout << "sum is " << sum;
9th Jul 2017, 5:06 PM
Andrés04_ve
Andrés04_ve - avatar
+ 2
cout << "sum is " << sum << endl;
9th Jul 2017, 3:09 PM
‎ ‏‏‎Anonymous Guy