+ 2

How to use input/output in C++?

What is the scanf() and printf() from C in C++?

28th Jan 2018, 3:10 PM
Eudecio Gabriel dos Reis Silva
Eudecio Gabriel dos Reis Silva - avatar
5 Answers
28th Jan 2018, 3:33 PM
Ipang
+ 7
Provided cstdio is included, both scanf() and printf() can be used in conventional C++ compilers but not in Code Playground You can also use std::cout and std::cin objects of iostream in C++ for output and input, respectively Learn more: https://www.sololearn.com/Course/CPlusPlus/?ref=app
28th Jan 2018, 3:18 PM
DAB
DAB - avatar
+ 6
std::cin>>variable; std::cout<<something; are most common
28th Jan 2018, 3:13 PM
J.G.
J.G. - avatar
+ 4
Example- cout << "Enter your age:"; cin >> age; cout << "\nYour age is: "<<age;
28th Jan 2018, 3:18 PM
Arpit Kukreja
Arpit Kukreja - avatar
+ 1
I always input using namespace std; it helps by making it so I don't need to type std over and over again. But I using cout and cin is good, you can add if functions for the cin, or just use cout<<a; while a is your answer.
28th Jan 2018, 10:47 PM
Alex
Alex - avatar