I saw someone to use a function instead of cin/scanf to input a number;
like that :
int n;
n = in();
where in() function is given bellow :
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch =getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')break;}return (ng?-n:n);} ?
i don't know what is faster , i also don't know , how scanf or cin works , can anyone please tell me ????