Read int and char array from keyboard : int read « Data Types « C++ Tutorial






#include <iostream>  
#include <stdio.h>  
using namespace std;
main(void)  
{  
  int i;  
  char str[80];  
     
  cout << "I like Turbo C++.\n";  
     
  printf("You can use printf(), but most C++ programs don't.\n");  
     
  cout << "enter a number: ";  
  cin >> i;  
     
  cout << "your number is " << i << "\n";  
     
  cout << "enter a string: ";  
  cin >> str;  
  cout << str;  
     
  return 0;  
}








2.2.int read
2.2.1.Read int and do the calculation
2.2.2.Use relational operators to compare int type variables
2.2.3.Read integer from console using cin
2.2.4.Read int and char array from keyboard