Skip to content

Instantly share code, notes, and snippets.

@Technici4n
Last active May 18, 2017 18:50
Show Gist options
  • Save Technici4n/c3e029c5ff49632fbf554dd6fd9f5a71 to your computer and use it in GitHub Desktop.
Save Technici4n/c3e029c5ff49632fbf554dd6fd9f5a71 to your computer and use it in GitHub Desktop.
int n;
string buff;
int main()
{
int cases;
// Read cases
cin >> cases;
while(cases--)
{
// Read n
cin >> n;
// Empty this line
getline(cin, buff);
// While there is a next line and the next line is not empty
while(getline(cin, buff) && buff != "")
{
char c;
int i1, i2;
stringstream ss(buff);
// Put 'buff' in a stream that can be used like cin
// Extract from the stream the char and the 2 numbers
ss >> c >> i1 >> i2;
/**
* Do something
*/
}
/**
* Do something
*/
if(cases > 0)
cout << "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment