Here is a C++ program to read a character and Integer from user and print on screen. In this program, we will take an integer and character as input from user using cin stream and print it on screen using cout. This program helps in understanding basic input and output of C++ programming language.
C++ program to read and print an integer and character
#include <iostream> using namespace std; int main() { int val; char c; // Read input cout << "Enter an Integer and a Character\n"; cin >> val >> c; // Print on screen cout << "Entered Integer : " << val << endl; cout << "Entered Character : " << c; return 0; }Output
Enter an Integer and a Character 12 A Entered Integer : 12 Entered Character : A
Recommended Posts