Logo

Programming-Idioms

  • Pascal
  • C++

Idiom #120 Read integer from stdin

Read an integer value from the standard input into the variable n

#include <iostream>
std::cin >> n;
read(n);
#include <stdio.h>
int n;
scanf("%d", &n);

New implementation...
< >
programming-idioms.org