fast input output in c++
C++
void fastscan(int &number)
{
//variable to indicate sign of input number
bool negative = false;
register int c;
number = 0;
// extract current character from buffer
c = getchar();
if (c=='-')
{
// number is negative
negative = true;
// extract the next character from the buffer
c = getchar();
}
// Keep on extracting characters if they are integers
// i.e ASCII Value lies from '0'(48) to '9' (57)
for (; (c>47 && c<58); c=getchar())
number = number *10 + c - 48;
// if scanned input has a negative sign, negate the
// value of the input number
if (negative)
number *= -1;
}
// Function Call
int main()
{
int number;
fastscan(number);
cout << number << "\n";
return 0;
}
ios_base::sync_with_stdio(false); cin.tie(NULL);
Also in C++:
- Title
- c++ modulo make it give only positive numbers
- Category
- C++
- Title
- do while loop c++
- Category
- C++
- Title
- lisy stl C++
- Category
- C++
- Title
- command line options in c++
- Category
- C++
- Title
- nan c++ example
- Category
- C++
- Title
- Qt asynchronous HTTP request
- Category
- C++
- Title
- c++ read file line by line
- Category
- C++
- Title
- mingw32/bin/ld.exe: C:\Users\mfrom\AppData\Local\Temp\ccSKcRks.o:PizzaPi.cpp:(.text$_ZN5PizzaC2Ev[__ZN5PizzaC2Ev]+0xa): undefined reference to `vtable for Pizza' collect2.exe: error: ld returned 1 exit status
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- c++ code for polynomial addition
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- coping 2d vector in cpp
- Category
- C++
- Title
- sort function in cpp
- Category
- C++
- Title
- c++ overloaded equality check operator
- Category
- C++
- Title
- restting a queue stl
- Category
- C++
- Title
- initialize int c++
- Category
- C++
- Title
- log base e synthax c++
- Category
- C++
- Title
- c++ overload operator
- Category
- C++
- Title
- cpp nan value
- Category
- C++
- Title
- how initilaize deffult value to c++ class
- Category
- C++
- Title
- time function c++
- Category
- C++
- Title
- calling by reference c++
- Category
- C++
- Title
- what are the different ways to traverse a binary tree
- Category
- C++
- Title
- runtime error in c++
- Category
- C++
- Title
- while loops
- Category
- C++
- Title
- how to make string get spaces c++
- Category
- C++
- Title
- set of vectors c++
- Category
- C++
- Title
- memcmp in cpp
- Category
- C++
- Title
- longest common subsequence
- Category
- C++
- Title
- c++ class constructor
- Category
- C++
- Title
- string to number in c++
- Category
- C++
- Title
- c++ function to find minimum element in array
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- how to measure program run time in c++
- Category
- C++
- Title
- stack function in cpp
- Category
- C++
- Title
- pop_back
- Category
- C++
- Title
- screen record ios simulator
- Category
- C++
- Title
- c++ excel blank cells
- Category
- C++
- Title
- monotonic deque
- Category
- C++
- Title
- what is difference between ciel and floor
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- c++ push multiple elements to vector
- Category
- C++
- Title
- double pointers C++
- Category
- C++
- Title
- Combination Sum
- Category
- C++
- Title
- c++ program how to let the user choose different game modes
- Category
- C++
- Title
- constant variables in c++
- Category
- C++
- Title
- c++ loop trhought object
- Category
- C++
- Title
- visual studio 2019 read and write text file c++
- Category
- C++
- Title
- how to convert n space separated integers in c++
- Category
- C++
- Title
- c++ pi
- Category
- C++
- Title
- counting valleys hackerrank solution in c++
- Category
- C++
- Title
- merge sort in c++
- Category
- C++
- Title
- passing array to function c++ pointer
- Category
- C++
- Title
- sort a string alphabetically c++
- Category
- C++
- Title
- c++ char define
- Category
- C++
- Title
- how to write an or in c++
- Category
- C++
- Title
- c++ allocate dynamic with initial values
- Category
- C++
- Title
- in c, is class uppercase or lowercase
- Category
- C++
- Title
- substr in c++
- Category
- C++
- Title
- how to sort vector in c++
- Category
- C++
- Title
- c++ char if
- Category
- C++
- Title
- bitset c++
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- how to append two vectors in c++
- Category
- C++
- Title
- number of islands leetcode code
- Category
- C++
- Title
- rosrun actionlib_msgs genaction.py
- Category
- C++
- Title
- how to iterate through a map in c++
- Category
- C++
- Title
- error: redefinition of ‘class Customer’
- Category
- C++
- Title
- double to int c++
- Category
- C++
- Title
- decimal to hex cpp
- Category
- C++
- Title
- cs1955 unity vector3
- Category
- C++
- Title
- qt graphics scene map cursor position
- Category
- C++
- Title
- length of array in cpp
- Category
- C++
- Title
- apple and orange hackerrank solution in c++
- Category
- C++
- Title
- make an x using asterisk c++
- Category
- C++
- Title
- C++ pointer arithmetic
- Category
- C++
- Title
- unordered_set c++
- Category
- C++
- Title
- All palindromic substrings
- Category
- C++
- Title
- c++ remove element from vector
- Category
- C++
- Title
- jump to case label c++
- Category
- C++
- Title
- C++ If
- Category
- C++
- Title
- c++ write new file
- Category
- C++
- Title
- using namespace std in c++
- Category
- C++
- Title
- list conda environments
- Category
- C++
- Title
- date to string c++
- Category
- C++
- Title
- c++ set console title
- Category
- C++
- Title
- hohw toparse a string in c++
- Category
- C++
- Title
- what is atoi in strinf
- Category
- C++
- Title
- c++ overloaded == operator
- Category
- C++
- Title
- zeros of array c++
- Category
- C++
- Title
- dynamic 2d array c++
- Category
- C++
- Title
- getch c++ library
- Category
- C++
- Title
- making random numbers in c++
- Category
- C++
- Title
- private and public in namespace cpp
- Category
- C++
- Title
- c++ smart pointer 2d array
- Category
- C++
- Title
- what does map.count() return in c++
- Category
- C++
- Title
- change int to string cpp
- Category
- C++
- Title
- Html tabulation
- Category
- C++
- Title
- c++ delete printed characters
- Category
- C++
- Title
- sqrt cpp
- Category
- C++