Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Last active September 20, 2017 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invatainfo/eac669d4d045e882521409129a692d5a to your computer and use it in GitHub Desktop.
Save invatainfo/eac669d4d045e882521409129a692d5a to your computer and use it in GitHub Desktop.
#include <fstream.h>
ifstream f("BAC.TXT");
void main() {
long x, y, n;
f >> x;
n = 1;
while (f >> y) {
if (x == y)
n++;
else {
cout << x << " " << n << " ";
n = 1;
}
x = y;
}
cout << x << " " << n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment