Está en la página 1de 1

#include <iostream> #include <windows.h> #include <stdio.

h> using namespace std; #define limite 5 void insertar(char datos[],int tiempo[],int l){ for(int i = 0; i < (l); i++){ cout << "inserte el tiempo en el proceso [" << datos[i] << "]: "; cin >> tiempo[i]; } } void fifo(char datos[],int tiempo[], int l){ int tiempoTotal = 0; int timer; float tiempoReturn = 0.0f; insertar(datos,tiempo, l); for(int j = 0;j < l; j++){ tiempoTotal += tiempo[j]; tiempoReturn += tiempoTotal; timer=tiempoTotal; cout <<"\n""tiempo de retorno de["<<datos[j]<<"]: "<<tiempoTotal<<"\t"; while (timer!=0){ Sleep(1000); timer--; printf("-> "); } } } int main(){ cout<<"\t\t\tSimulacion de FIFO en C++"<<endl; cout<<"\t\t_______________________________________\n"<<endl; char datos[limite] = {'a','b','c','d','e'}; int tiempo[limite]; fifo(datos,tiempo,limite); cin.get(); cin.get(); return 0; }

También podría gustarte