Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cstdlib>
- using namespace std;
- inline void append_to_int(int* num, const char c)
- {
- *num *= 10;
- *num += c - '0';
- }
- int main()
- {
- unsigned long long N;
- FILE* f = fopen("in.txt", "r");
- fseek(f, 0, SEEK_END);
- N = ftell(f) - 1;
- rewind(f);
- char* vec = (char*)malloc(sizeof(int) * N);
- fread(vec, sizeof(int), N, f);
- int x = 0;
- for(int i = 0; i < N; i++)
- {
- if(isdigit(vec[i]))
- {
- append_to_int(&x, vec[i]);
- }
- else
- {
- printf("%d ", x);
- x = 0;
- }
- }
- printf("\n");
- free(vec);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement