Search
 
SCRIPT & CODE EXAMPLE
 

CPP

vector stop at newline

// read N1 & N2 using cin
int N1, N2;
cin >> N1;
cin >> N2;

// skip the new line which is after N2 (i.e; 2 value in 1st line)
cin.ignore(numeric_limits<streamsize>::max(), '
');

// now read 3 4 5 elements
int ele;
// 2nd EOF condition may required,
//    depending on if you dont have last new-line, and it is end of file.
while ((cin_.peek() != '
') && (cin_.peek() != EOF)) {
  cin >> ele;
  // do something with ele
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: To toggle (flip the status of) the k-th item of the set 
Cpp :: convert string to wide string 
Cpp :: how to merge string array in C++ 
Cpp :: find maximum contiguous Sub arrays 
Cpp :: pcl c++ read .pcd 
Cpp :: warning in range-based for loop in C++. How to resolve it in vscode? 
Cpp :: xor in c++ 
Cpp :: sort array using stl 
Cpp :: C++ Booleans 
Cpp :: return value from a thread 
Cpp :: Patrick and Shopping codeforces in c++ 
Cpp :: c++ starting syntaz 
Cpp :: https://www.google 
Cpp :: printing sub arrays 
Cpp :: arduino jumper programmieren 
Cpp :: C++: Methods of code shortening in competitive programming 
Cpp :: C++ Ranged Based for Loop 
Cpp :: how to use printf with microseconds c++ 
Cpp :: Configuring an c++ OpenCV project with Cmake 
Cpp :: total sales in array c++ two dimensional array 
Cpp :: c++ else 
Cpp :: c++ compile to msi 
Cpp :: char * in c++ 
Cpp :: subsequence 
Cpp :: return function in cpp 
Cpp :: C++ Assignment Operators 
Cpp :: string array 2d c++ 
C :: colourful text in c 
C :: how to download file in powershell 
C :: C overwrite last line 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =