sexta-feira, 17 de abril de 2009

Exercício de Matriz

Grupo 1: Em uma empresa há 3 setores com 6 funcionários. O gerente da empresa necessita de um programa que leia os salários brutos de todos os funcionários e calcule o salário liquido dos funcionários do 2º setor de acordo com os seguintes valores: desconto de 10% de INSS. Mostre os salários líquidos calculados.

8 comentários:

  1. postado por Rafael...
    ficou um pouco grande mas vê se está rodando.



    Program exe1;
    type
    matriz=array[1..3,1..6] of real;
    vetor1=array[1..3] of string;
    matriz2=array[1..3,1..6] of real;
    var
    salario:matriz;
    setor:vetor1;
    liquido:matriz2;
    i,j:integer;
    Begin
    clrscr;
    for i:=1 to 3 do
    begin
    gotoxy(2,4);
    writeln('SETOR');
    gotoxy(2,20);
    writeln('SETOR');
    gotoxy(26,2);
    writeln('SALÁRIO BRUTO');
    gotoxy(18,4);
    writeln('F1');
    gotoxy(18,20);
    writeln('F1');
    gotoxy(26,4);
    writeln('F2');
    gotoxy(26,20);
    writeln('F2');
    gotoxy(34,4);
    writeln('F3');
    gotoxy(34,20);
    writeln('F3');
    gotoxy(42,4);
    writeln('F4');
    gotoxy(42,20);
    writeln('F4');
    gotoxy(50,4);
    writeln('F5');
    gotoxy(50,20);
    writeln('F5');
    gotoxy(58,4);
    writeln('F6');
    gotoxy(58,20);
    writeln('F6');
    gotoxy(26,18);
    writeln('SALÁRIO LÍQUIDO');
    gotoxy(2,2*i+4);
    readln(setor[i]);
    for j:=1 to 6 do
    begin
    gotoxy(8*j+10,2*i+4);
    readln(salario[i,j]);
    liquido[i,j]:=salario[i,j]-(salario[i,j]*10/100);
    end;
    end;
    gotoxy(2,22);
    writeln(setor[2]);
    gotoxy(12,22);
    writeln('R$');
    gotoxy(18,22);
    writeln(liquido[2,1]:2:2);
    gotoxy(26,22);
    writeln(liquido[2,2]:2:2);
    gotoxy(34,22);
    writeln(liquido[2,3]:2:2);
    gotoxy(42,22);
    writeln(liquido[2,4]:2:2);
    gotoxy(50,22);
    writeln(liquido[2,5]:2:2);
    gotoxy(58,22);
    writeln(liquido[2,6]:2:2);
    readln;
    readln;
    End.

    ResponderExcluir
  2. As respostas terão que ser postadas até o dia 29 de Abril.

    ResponderExcluir
  3. *********Postado por Maiara C.***********
    Se estiver errado me avisa...

    Program exe;
    type
    mat=array[1..3,1..6] of real;
    vetor1=array[1..3] of string;
    mat2=array[1..3,1..6] of real;
    var
    sal:mat;
    setor:vetor1;
    salliq:mat2;
    i,j:integer;
    Begin
    clrscr;
    for i:=1 to 3 do
    begin
    gotoxy(2,4);
    writeln('Setor');
    gotoxy(2,20);
    writeln('Setor');
    gotoxy(26,2);
    writeln('Salário bruto');
    gotoxy(18,4);
    writeln('a');
    gotoxy(18,20);
    writeln('b');
    gotoxy(26,4);
    writeln('c');
    gotoxy(26,20);
    writeln('d');
    gotoxy(34,4);
    writeln('e');
    gotoxy(34,20);
    writeln('f');
    gotoxy(42,4);
    writeln('g');
    gotoxy(42,20);
    writeln('h');
    gotoxy(50,4);
    writeln('i');
    gotoxy(50,20);
    writeln('j');
    gotoxy(58,4);
    writeln('l');
    gotoxy(58,20);
    writeln('m');
    gotoxy(26,18);
    writeln('Salário Liquido');
    gotoxy(2,2*i+4);
    readln(setor[i]);
    for j:=1 to 6 do
    begin
    gotoxy(8*j+10,2*i+4);
    readln(sal[i,j]);
    salliq[i,j]:=sal[i,j]-(sal[i,j]*10/100);
    end;
    end;
    gotoxy(2,22);
    writeln(setor[2]);
    gotoxy(12,22);
    writeln('R$');
    gotoxy(18,22);
    writeln(salliq[2,1]:2:2);
    gotoxy(26,22);
    writeln(salliq[2,2]:2:2);
    gotoxy(34,22);
    writeln(salliq[2,3]:2:2);
    gotoxy(42,22);
    writeln(salliq[2,4]:2:2);
    gotoxy(50,22);
    writeln(salliq[2,5]:2:2);
    gotoxy(58,22);
    writeln(salliq[2,6]:2:2);
    readln;
    readln;
    End.

    ResponderExcluir
  4. Postado por Nilo Sergio

    program exe1;
    type
    matriz=array[1..3,1..6] of real;
    var
    mat:matriz;
    funcio,setor:string;
    salbruto,salliq,desconto:real;
    i,j:integer;
    begin
    for i:=1 to 3 do
    begin
    gotoxy(4,5);
    writeln('setor');
    gotoxy(16,5);
    readln(setor);
    for j:=1 to 6 do
    begin
    gotoxy(22,5);
    writeln('funcionario');
    gotoxy(28,5);
    readln(funcio);
    gotoxy(34,5);
    writeln('salario bruto');
    gotoxy(44,5);
    readln(salbruto);
    if (setor=2) then
    begin
    salliq:=salbruto-(salbruto*10/100);
    end;
    end;

    end;
    readln(salliq);

    end.

    ResponderExcluir
  5. RAONY



    Program exe;
    type
    matriz=array[1..3,1..6] of real;
    vetor=array[1..3] of string;
    matriz2=array[1..3,1..6] of real;
    var
    salbruto:matriz;
    tipo:vetor;
    salliq:matriz2;
    i,j:integer;
    Begin
    clrscr;
    for i:=1 to 3 do
    begin
    gotoxy(2,4);
    writeln('tipo');
    gotoxy(2,20);
    writeln('tipo');
    gotoxy(26,2);
    writeln('Salário bruto');
    gotoxy(18,4);
    writeln('1');
    gotoxy(18,20);
    writeln('2');
    gotoxy(26,4);
    writeln('3');
    gotoxy(26,20);
    writeln('4');
    gotoxy(34,4);
    writeln('5');
    gotoxy(34,20);
    writeln('6');
    gotoxy(42,4);
    writeln('7');
    gotoxy(42,20);
    writeln('8');
    gotoxy(50,4);
    writeln('9');
    gotoxy(50,20);
    writeln('10');
    gotoxy(58,4);
    writeln('11');
    gotoxy(58,20);
    writeln('12');
    gotoxy(26,18);
    writeln('Salário a receber');
    gotoxy(2,2*i+4);
    readln(tipo[i]);
    for j:=1 to 6 do
    begin
    gotoxy(8*j+10,2*i+4);
    readln(salbruto[i,j]);
    salliq[i,j]:=salbruto[i,j]-(salbruto[i,j]*10/100);
    end;
    end;
    gotoxy(2,22);
    writeln(tipo[2]);
    gotoxy(12,22);
    writeln('R$');
    gotoxy(18,22);
    writeln(salliq[2,1]:2:2);
    gotoxy(26,22);
    writeln(salliq[2,2]:2:2);
    gotoxy(34,22);
    writeln(salliq[2,3]:2:2);
    gotoxy(42,22);
    writeln(salliq[2,4]:2:2);
    gotoxy(50,22);
    writeln(salliq[2,5]:2:2);
    gotoxy(58,22);
    writeln(salliq[2,6]:2:2);
    readln;
    readln;
    End.

    ResponderExcluir
  6. Bianca
    Program Pzim ;
    type
    matriz= array [1..3,1..6] of real;
    matrizb=array[1..3,1..6] of real;
    vetor=array [1..3] of string;

    var
    salbruto:matriz;
    salliq:matrizb;
    setor:vetor;
    I,c:integer;

    Begin

    for I:=1 to 3 do
    begin
    gotoxy(3,3);
    writeln(' setor 1:') ;
    gotoxy(3,4);
    writeln(' setor 2:');
    gotoxy(3,5);
    writeln(' setor 3:');
    gotoxy(20,1);
    writeln('Digite Salario bruto:');
    gotoxy(12,i+2);
    readln(setor [i]);
    for c:= 1 to 6 do
    begin
    gotoxy(8*c+12,i+2);
    readln(salbruto[i,c]);
    If i=2 then
    salliq[i,c]:=salbruto[i,c]- (salbruto[i,c]* 10/100)
    else
    salliq[i,c]:= salbruto[i,c];
    gotoxy(20,7);
    writeln('Sal. líquido:');
    gotoxy(8*c+12,i+8);
    writeln(salliq[i,c] :2:2);
    end;
    readln;
    end;
    end.

    ResponderExcluir
  7. Daniella Lavinas
    Program Salario1 ;
    type
    matriz= array [1..3,1..6] of real;
    matrizb=array[1..3,1..6] of real;
    vetor=array [1..3] of string;

    var
    salbruto:matriz;
    salliq:matrizb;
    setor:vetor;
    I,c:integer;

    Begin

    for I:=1 to 3 do
    begin
    gotoxy(3,3);
    writeln(' setor 1:') ;
    gotoxy(3,4);
    writeln(' setor 2:');
    gotoxy(3,5);
    writeln(' setor 3:');
    gotoxy(20,1);
    writeln('Digite Salario bruto:');
    gotoxy(12,i+2);
    readln(setor [i]);
    for c:= 1 to 6 do
    begin
    gotoxy(8*c+12,i+2);
    readln(salbruto[i,c]);
    If i=2 then
    salliq[i,c]:=salbruto[i,c]- (salbruto[i,c]* 10/100)
    else
    salliq[i,c]:= salbruto[i,c];
    gotoxy(20,7);
    writeln('Sal. líquido:');
    gotoxy(8*c+12,i+8);
    writeln(salliq[i,c] :2:2);
    end;
    readln;
    end;
    end.

    ResponderExcluir
  8. Vou postar o Gabarito,ok.

    Program empresa;
    type
    Matriz=array[1..3,1..6] of integer;
    Vetor= array[1..3] of string;
    var
    SB:matriz;
    Setor:Vetor;
    i,j:integer;
    Sl:real;
    Begin
    Writeln('Digite salario');
    Writeln('Digite setor');
    For I:= 1 to 3 do
    begin
    readln(Setor[I]);
    For J:= 1 to 6 do
    readln(sb[i,j]);
    if= 2 then
    begin
    sl:= sb[i,j]-(sb[i,j]*10/100);
    writeln(sl);
    end;
    end;
    end;
    End.

    OBS: sb é salario bruto e Sl é salario liquido,
    eu só não coloquei gotoxy, mais a resposta é essa mesma.

    ResponderExcluir