Pesquisar na Comunidade
Mostrando resultados para as tags ''carregar arquivo no programa''.
Encontrado 1 registro
-
Uma máquina gera um arquivo com informações (log) no formato de linhas de texto agrupando as seguintes informações em cada linha: {int dia, int hora, int minuto, int operacao, int status} - dia é o número do dia no ano; - hora é a hora desse dia; - minuto é o minuto dessa hora; - operacao pode ser: 1 - operação de carregar matéria-prima 1; 2 - operação de carregar matéria-prima 2; 3 - operação de carregar matéria-prima 3; 4 - operação de processo de secagem; 5 - operação de processo de lavagem; ou 6 - operação de processo de tingimento; - status pode ser: 0 - operação bem sucedida; 1 - sobrecarga leve; 2 - sobrecarga com probabilidade de dano; ou 3 - parada por erro de funcionamento; Faça um programa que leia o arquivo de log da máquina (disponível no moodle) até o fim e gere as seguintes informações (cada aluno deverá resolver dois itens a serem sorteados ou definidos pelo professor): a) Qual o percentual de cada matéria prima carregada na máquina. b) Quantos operações tiveram status 0 e o percentual em relação aos demais; c) Calcule o percentual de operações bem-sucedidas (status 0) em relação as mal-sucedidas (status 3); d) Gere um vetor para armazenar as paradas por semana (cada 7 dias) (o índice indica a semana); e) Gere um vetor para armazenar a matéria mais carregada na máquina em cada dia; f) Gere um vetor para armazenar o status que aconteceram mais por hora do dia (o índice do vetor indica a hora do dia); g) Nos dias pares, quantas vezes a máquina foi carregada com a matéria-prima 1 no período da manhã; h) Quantas vezes aconteceram o estado de operação bem sucedida e então parada por erro considerando a mesma operação; i) Quantas vezes aconteceram o estado de operação bem sucedida e depois parada por erro considerando operações diferentes; j) Quantas vezes as operações 4, 5 e 6 não foram executadas em sequência; Dicas: A) use o exemplo das transparências da aula 10 (arquivos) para ler o arquivo em modo texto. Lembre-se que o separador de cada informação é uma vírgula e não o espaço em branco como no exemplo: fscanf(“%d,%d,...”...). B) os vetores podem usar o próximo índice como indicador da semana avaliada ou do dia, ou da hora, etc. C) pode-se utilizar uma variável auxiliar para identificar que o processo está seguindo uma sequência. Na primeira vez a variável deve armazenar o código da operação/status a ser avaliado no início e quando ocorrer, essa variável auxiliar deve mudar para o próximo código de operação até que um código de fim seja alcançado. Exemplo: Indicar quantas vezes ocorre o carregamento da matéria prima 1 e depois 2 em seguida. segue o arquivo em log. Formato: dia, hora, minuto, operação, status 1,8,6,1,1 1,8,9,4,1 1,8,23,3,0 1,8,26,5,1 1,9,2,2,2 1,9,16,4,1 1,10,0,4,3 1,10,12,6,1 1,10,26,1,2 1,11,5,6,1 1,12,4,6,0 1,13,7,3,0 1,13,10,5,0 1,13,16,6,1 1,14,0,2,1 1,15,4,6,0 1,15,9,2,0 1,15,22,5,1 1,16,4,4,0 1,16,12,4,0 1,17,2,3,2 1,17,11,4,2 1,18,6,1,0 1,19,1,4,2 1,20,3,3,1 1,21,6,6,3 1,22,3,6,0 1,22,15,4,1 1,23,5,3,1 1,24,8,5,2 1,25,0,2,0 1,26,3,4,1 2,8,0,1,2 2,9,4,5,0 2,10,5,4,0 2,10,14,6,0 2,11,5,3,2 2,12,1,4,3 2,12,5,5,0 2,12,12,4,2 2,13,5,3,0 2,13,13,6,1 2,14,7,6,0 2,15,7,2,2 2,15,17,4,2 2,16,6,4,0 2,16,16,4,3 2,16,25,2,0 2,16,32,5,0 2,16,42,2,0 2,16,54,5,0 2,16,59,3,0 2,17,7,4,0 2,17,20,6,0 2,17,34,5,1 2,17,40,4,1 2,17,45,2,0 2,17,54,4,1 2,18,3,5,0 2,18,8,4,0 2,19,1,1,0 2,20,1,4,2 2,21,3,3,0 2,22,2,6,2 2,23,2,5,1 2,23,16,6,0 2,23,30,3,2 2,23,38,4,3 2,24,5,6,2 2,24,19,5,0 3,8,8,6,0 3,8,13,4,0 3,8,23,1,1 3,9,5,5,0 3,10,4,4,0 3,10,16,1,2 3,10,26,6,0 3,11,5,2,1 3,12,4,6,0 3,12,15,6,2 3,13,5,3,0 3,13,19,4,0 3,13,29,1,2 3,14,2,4,0 3,15,3,5,2 3,15,17,3,1 3,16,8,6,2 3,17,1,2,0 3,17,12,4,1 3,18,4,1,1 3,18,7,6,0 3,19,2,6,0 3,19,9,1,0 3,20,4,6,0 3,21,4,4,3 3,21,17,6,1 3,22,5,2,2 3,23,4,6,0 3,24,6,2,0 3,25,4,6,3 3,25,10,4,0 3,26,4,4,2 4,8,4,3,0 4,8,12,4,1 4,8,16,5,0 4,9,2,4,0 4,10,4,2,0 4,11,5,4,1 4,12,0,2,0 4,12,11,5,0 4,12,19,3,1 4,12,28,6,0 4,12,40,2,0 4,13,7,4,3 4,14,8,2,2 4,14,20,5,0 4,15,2,1,0 4,16,8,5,0 4,17,8,5,3 4,17,17,6,1 5,8,1,5,1 5,9,0,1,0 5,9,6,5,3 5,10,5,5,2 5,10,17,5,2 5,11,7,1,0 5,11,16,4,3 5,11,19,1,0 5,11,31,4,2 5,11,38,5,1 5,12,0,4,0 5,13,8,6,0 5,13,18,2,0 5,13,28,4,1 5,14,6,4,2 5,14,12,5,1 5,15,4,2,2 5,16,0,6,2 5,16,8,5,2 5,16,22,4,0 5,16,32,1,0 5,17,6,6,0 5,17,19,6,3 5,18,7,6,3 5,19,6,1,0 8,8,0,5,2 8,8,14,6,0 8,9,3,3,1 8,10,5,6,1 8,10,19,1,0 8,10,31,4,0 8,11,4,4,3 8,11,7,5,2 8,11,17,2,1 8,12,2,6,0 8,12,9,3,0 8,12,21,5,1 8,13,0,4,0 8,14,5,3,0 8,14,14,5,1 8,15,3,1,0 8,15,16,6,1 8,16,3,4,0 8,16,9,3,0 8,17,6,6,1 8,17,20,1,0 8,17,28,4,3 8,17,32,4,0 8,18,1,2,0 8,19,1,4,1 8,20,1,6,2 9,8,3,4,2 9,8,9,3,1 9,9,3,6,0 9,10,1,5,0 9,10,15,1,0 9,11,2,4,1 9,11,10,2,2 9,11,21,4,2 9,12,3,2,3 9,13,1,6,0 9,13,9,2,2 9,13,13,5,2 9,13,18,4,1 9,13,25,4,0 9,13,34,3,0 9,14,3,6,2 9,15,3,6,1 9,15,12,5,1 9,16,5,6,2 9,16,15,3,1 10,8,8,6,0 10,8,20,4,0 10,8,28,6,2 10,9,8,5,0 10,10,1,5,0 10,10,11,3,2 10,10,14,4,0 10,10,22,3,0 10,10,29,6,1 10,11,7,4,1 10,12,7,1,0 10,13,8,5,0 10,14,8,3,0 10,15,1,5,0 11,8,6,6,0 11,9,2,6,3 11,10,7,2,1 11,11,0,4,1 11,11,4,2,2 11,12,3,4,0 11,13,5,6,1 11,13,12,3,2 11,13,23,6,0 11,14,2,1,0 11,15,8,5,2 11,16,4,3,2 11,16,12,4,0 11,17,1,5,3 11,18,4,4,0 11,19,6,4,1 12,8,0,4,3 12,8,10,5,1 12,8,16,5,0 12,8,21,3,0 12,8,35,6,0 12,8,48,5,2 12,8,56,3,0 12,8,60,5,1 12,9,6,6,0 12,10,8,6,1 12,11,8,2,2 12,12,1,5,0 12,13,8,3,2 12,13,15,6,0 12,14,2,1,0 12,14,7,6,0 12,15,0,3,3 12,15,9,6,0 12,16,5,1,2 15,8,5,6,2 15,8,15,2,0 15,8,27,6,2 15,9,1,1,1 15,10,1,5,1 15,10,6,4,0 15,10,15,3,3 15,10,29,6,0 15,11,6,2,1 15,12,5,6,0 15,12,13,6,0 15,12,20,4,0 15,12,29,6,3 15,13,2,6,1 15,14,3,6,0 15,15,5,5,1 15,15,11,3,0 15,16,7,5,2 15,16,13,6,0 15,16,20,6,0 15,17,4,1,0 15,17,16,4,0 16,8,7,3,0 16,8,21,6,0 16,9,3,2,2 16,9,12,6,0 16,10,6,6,0 16,11,0,3,1 16,11,14,5,2 16,11,21,6,0 16,11,32,3,0 16,12,1,5,0 16,13,2,6,2 16,13,6,2,2 16,14,4,6,1 16,14,7,3,0 16,15,5,5,2 16,15,17,5,0 16,15,29,6,0 16,15,42,4,0 16,16,6,6,0 16,17,8,5,1 16,17,22,4,2 16,18,7,3,1 16,18,12,5,2 17,8,5,2,0 17,9,4,5,2 17,10,3,4,1 17,11,8,2,1 17,12,1,5,0 17,12,6,4,2 17,12,18,1,0 17,13,1,5,2 17,14,1,1,0 17,14,8,6,0 17,14,13,3,2 17,15,3,5,1 17,15,8,5,2 17,16,3,5,1 17,16,12,1,3 17,16,18,5,0 17,17,0,2,0 17,18,2,4,1 17,19,3,1,0 17,20,1,5,0 17,21,4,4,0 18,8,8,4,3 18,9,7,6,0 18,9,20,1,0 18,9,28,6,2 18,9,39,5,2 18,9,44,1,0 18,9,49,5,0 18,10,1,2,2 18,10,11,5,1 18,10,25,4,1 18,11,7,5,3 18,12,3,1,0 18,13,3,5,0 18,14,1,2,2 18,14,9,6,0 18,15,0,2,3 18,16,8,4,0 18,17,3,3,3 18,17,11,5,2 18,18,2,6,1 18,19,8,3,0 18,19,19,6,2 18,20,1,6,0 18,21,1,1,1 18,21,5,4,1 19,8,0,2,0 19,9,5,6,0 19,10,2,4,0 19,11,6,3,0 19,12,1,5,2 19,12,10,3,2 19,13,0,6,1 19,13,13,2,2 19,13,18,4,1 19,14,8,3,3 19,15,8,5,1 19,16,2,6,0 19,17,3,1,0 19,18,4,6,0 19,18,7,1,1 19,18,13,5,0 19,19,8,4,0 19,20,4,4,0 19,20,14,4,0 19,21,3,3,0 22,8,4,4,0 22,8,9,5,1 22,9,4,6,0 22,9,14,1,2 22,10,4,4,0 22,11,8,2,1 22,12,0,5,0 22,12,14,3,1 22,12,23,6,0 22,12,26,1,1 22,13,5,4,1 22,14,5,3,0 22,15,3,4,1 22,16,1,1,1 22,16,7,5,3 22,17,1,1,0 22,17,8,5,2 22,17,20,4,1 22,18,6,5,1 22,18,13,1,0 22,18,19,5,0 22,19,4,6,2 22,19,12,2,1 22,19,24,4,0 22,20,4,5,0 22,20,11,6,0 22,21,7,6,3 22,22,6,2,0 22,22,9,6,0