Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Indicador de progreso en lenguaje C
- //Compilado en GCC 5.3.0
- //Fecha y hora: 11-10-2016 20:35 hora central de México
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- #include <time.h>
- int main (int argc, char **argv)
- {
- const short operations = 300;
- float inc = 100.0f / ((float)operations-1.0);
- float progress = 0.0f;
- short i, pos=0;
- for(i=0; i<=operations; i++) {
- progress+=inc;
- fprintf(stdout, "Progreso: %d\r", (int)progress); fflush(stdout);
- sleep(1);
- }
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment