Ir ao conteúdo
  • Cadastre-se

Murilo Murilo

Membro Pleno
  • Posts

    23
  • Cadastrado em

  • Última visita

posts postados por Murilo Murilo

  1. 
    package exercicio03;
    
    
    import javax.swing.JOptionPane;
    
    public class Exercicio03 {
    
        public static void main(String[] args) {
            
             double quociente = 0,aux = 0;
             double result = 0,aux1;
         
           Double a = Double.parseDouble(JOptionPane.showInputDialog(null,"digite o numero dividendo ","divisao",JOptionPane.PLAIN_MESSAGE ));
           Double b = Double.parseDouble(JOptionPane.showInputDialog(null,"digite o numero dividendo ","divisao",JOptionPane.PLAIN_MESSAGE ));
           
          while(aux >= b)
          {
                    aux1 = aux - b;  
                   result = quociente - quociente +1; 
                 
          }
          
           JOptionPane.showMessageDialog(null,a+ "/" +b+ " = " + result, "Area" ,JOptionPane.INFORMATION_MESSAGE );
        }
        
    }

     

  2. using System;
    
    namespace exercicios
    {
       public class Forma 
        {
          public int lado;
            public void setLado(int s) 
            {
                lado = s;
            }
    
        }
            interface Icusto
            {
                int getCusto(int area);
            }
    
        public class Quadrado : Forma, Icusto 
        {
            public int getArea() 
            {
                return (lado * lado);
            }
    
            public int getCusto(int area) 
            {
                return area * 10;
            }
        }
    
        class Program 
        {
            public static void main(string[] args) 
            {
                Quadrado qd = new Quadrado();
    
                Console.WriteLine("quadrado é do tipo type {0}", qd.GetType());
                int area;
                string c1 = "Exemplo";
                Console.WriteLine("c1: é tipo type{0}", c1.GetType());
                qd.setLado(5);
                area = qd.getArea();
    
                Console.WriteLine("A area é: {0}", qd.getArea());
                Console.WriteLine("O custo é: {0}", qd.getCusto(area));
            }
        }
    }

     

    Me ajudem !!!

     

  3.  
    
     
    
    using System; 
    
      
    
    namespace Exercicio2 
    
    { 
    
        class Program 
    
        { 
    
            static void Main(string[] args) 
    
            { 
    
                
    
                int num, horas; 
    
                double valorh, sal; 
    
      
    
                Console.WriteLine("digite o id do funcionario:"); 
    
                num = int.Parse(Console.ReadLine()); 
    
      
    
                Console.WriteLine("digite horas trabalhadas:"); 
    
                horas = int.Parse(Console.ReadLine()); 
    
      
    
                Console.WriteLine("digite valor por hora:"); 
    
                valorh = double.Parse(Console.ReadLine()); 
    
      
    
                sal = valorh * horas; 
    
      
    
                Console.WriteLine("ID NUMBER =" + num); 
    
                Console.WriteLine("Salary= U$"  + sal); 
    
               
    
      
    
            } 
    
        } 
    
    } 
    
     

     

    exemplo  :   numero funcionário : 25 

                       horas trabalhadas: 100 

                      digite valor por hora: 5.50    

                      salario : 55000           errado ( )

                      salario : 550,00           certo (x)

     

  4. Código:
     

    Spoiler
    
    # include"stdio.h"
    # include"stdlib.h"
    # include"string.h"
    # include"locale.h"
    #include <time.h>
    # define  SIZE  53
    
    // Definição das variáveis
    
    char nome [SIZE] [ 50 ];
    char email [SIZE] [ 50 ];
    int datanasc [SIZE];
    int cpf [SIZE];
    char convidado [SIZE] [ 1 ];
    char especial [SIZE] [ 1 ];
    int op, t, opcaomp, encontrou;
    int j;
    int verifica_senha = 0 ;
    int verifica_user = 0 ;
    char login [ 10 ];
    char senha [ 8 ];
    
    // int status_es [3];
    // int status_cv [10];
    // int status_pt [40];
    
    int status [ 53 ];
    
    int assento [SIZE];
    
    // Definição das variáveis de funções
    void email_todos ();//corrigir erro 675;
    void  incluir ();
    void  excluir ();
    void  listar_livres ();
    void realizar_sorteio ();
    void  enviar_email ();//corrigir erros629;
    void email_um();//corrigir erro 705;
    
    void  listar_todos ();//corrigir erro line480;
    void  valida_senha ();
    void  gerenciar_visitante ();//line198;
    
    // Rotina principal
    
    int  main (void)
    {
    
    setlocale (LC_ALL, " portuguese " );
    
    do
    {
        system ( " clear " );
       
        printf ( " \n\n\n\n\n\n\n\t\t\t\t\t\t + ======================== ============================================ + " );
        printf ( " \n\t\t\t\t\t\t | | \n " );
        printf ( " \t\t\t\t\t\t\t | xxxx xxxx  xxxx     xxxx xxxx xxxxxxxxx | \n " );
        printf ( " \t\t\t\t\t\t\t | xxxx xxxx  xxxxxx   xxxx xxxx xxxx xxxx | \n " );
        printf ( " \t\t\t\t\t\t\t | xxxx xxxx  xxxx xx  xxxx xxxx xxxx xxxx | \n " );
        printf ( " \t\t\t\t\t\t\t | xxxx xxxx  xxxx  xx xxxx xxxx xxxxxxxxx | \n " );
        printf ( " \t\t\t\t\t\t\t | xxxxxxxxx  xxxx   xxxxxx xxxx xxxx | \n " );
        printf ( " \t\t\t\t\t\t\t | xxxxxxxxx  xxxx    xxxxx xxxx xxxx | \n " );
        printf ( " \t\t\t\t\t\t\t | | \n " );
        printf ( " \t\t\t\t\t\t\t | | \n " );
        printf ( "\t\t\t\t\t\t\t\t| UNIVERSIDADE PAULISTA | \n " );
        printf ( "\t\t\t\t\t\t | | \n " );
        printf ( " \t\t\t\t\t\t | | \n" );
        printf ( " \t\t\t\t\t\t| PALESTRA DIREITOS HUMANOS |\n");
        printf ( " \t\t\t\t\t\t| | \n" );
        printf ( " \t\t\t\t\t\t+ ====================================== ============================ + " );
        printf ( " \n\n\t\t\t\t\t\t  USUÁRIO .........: " );
        scanf("%c", login);
        //fflush(stdin);
        printf ( " \n\n\t\t\t\t\t\t  SENHA ...........: " );
        scanf("%c", senha);
         
        // Chama função para validar a senha
        //valida_senha ();
    
        if (verifica_senha == 1 )
        {
            opcaomp = 0 ;
    
            // Setar todos os assentos como livres
            for (j = 0 ; j < 52 ; j ++)
            {
              status [j] = 0 ;    // 0 - Assento livre -> 1 - Assento ocupado
            }
    
    
            // Apresenta a tela de menu principal
    
            while (opcaomp != 4 )
            {
                
                verifica_senha = 1 ;
                system ( " clear " );
                printf ( "  \n\n\n\n\n\n\t\t\t\t\t\t+======================== ============================================== + " );
                printf ( " \n \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | UNIP - UNIVERSIDADE PAULISTA | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | **** MENU PRINCIPAL **** | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | 1 - Gerenciar Visitante | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | 2 - Realizar Sorteio | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | 3 - Enviar Comunicado por E-mail | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t | 4 - Sair | \n " );
                printf ( " \t \t \t \t  \t \t| | \n " );
                printf ( " \t \t \t \t \t \t | | \n " );
                printf ( " \t \t \t \t \t \t + ====================================== ============================== + \n \n " );
                printf ( " \t \t \t \t \t \t                   Digite a opção desejada ......: " );
                scanf ( "%d " , & opcaomp);
                switch (opcaomp)
                {
    
                    case  1 :
                        gerenciar_visitante ();
                        break ;
    
                    case  2 :
                        realizar_sorteio ();
                        break ;
    
                    case  3 :
                        enviar_email ();
                        break;
    
                    case  4 :
                        system ( " exit " );
                        break ;
    
                    padrão :
                        printf ( " \n \t \t \t \t \t \t \t \t *** Opção Inválida! *** " );
                        getchar ();
    
                } // Switch
            } // while (opcaomp! = 4)
        } // se (verifica_senha == 1)
    
    } while (t != 3 && verifica_senha == 0 );
    
    } // Main
    
    // Função Valida Senha e Usuario
    
    void  valida_senha ()
    {
        int i, u;
        char c;
        char l;
        u = 0 ;
        i = 0 ;
    
        while ((c = getchar ()) != 13 )
        {
           senha [i] = c;
           login [u] = l;
           u ++;
           i ++;
           printf ( " * " );
        }
    
        login [u] =  0  ;
        senha [i] =  0 ;
        i = 0 ;
        u = 0 ;
        l = strcmp (login, " adm " );
        c = strcmp (senha, " 1 " );
    
        if (c == 1 && l == 1 ) // Senha e usuario Inválida
        {
            printf ( " \n \n \t \t \t \t \t *** Senha ou Usúario inválido! Tente novamente *** \n \n " );
            t = t + 1 ;
            system ( " cor 0c " );
            getchar ();
        }
        else // Senha e Usuario Correta
        {
            verifica_user = 1 ;
            verifica_senha = 1 ;
        }
        if (t == 3 )
        {
          // sistema ("cls");
          printf ( " \n \n \t \t \t \t \t *** Acesso Negado! *** \n \n " );
          getchar (); 
        }
    } // Fim da Função Valida Senha e Usuario
    
    // Função Gerenciar Visitante
    
    void  gerenciar_visitante ()
    {
    
        int j, op;
    
        op = 1 ;
    
        while (op != 5 )
        {
           system ( " cls " );
           printf ( " \n \n \n \n \n \n \t \t \t \t \t \t + ======================== ============================================== + " );
           printf ( " \n \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | UNIP - UNIVERSIDADE PAULISTA | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 1 - Incluir Participante | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 2 - Excluir Participante | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 3 - Listar Lugares Livres | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 4 - Mostrar Todos os Lugares | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 5 - Retornar ao Menu Principal | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t + ====================================== ============================== + \n \n " );
           printf ( " \t \t \t \t \t \t                   Digite a opção desejada ......: " );
           scanf ( "%d " , &op);
    
           switch (op)
           {
              case  1 :   // Incluir o participante
                 incluir ();
                break ;
    
              case  2 :
                 excluir ();
                break ;
    
              case  3 :
                listar_livres ();
                break ;
    
              case  4 :
                listar_todos ();
                break;
    
              case  5 :
               break ;
    
              default: 
                printf ( " \n \t \t \t \t \t \t \t \t *** Opção Inválida! *** " );
                getchar ();
                break;
    
           } // Switch
        } // enquanto (opcao! = 5)
    } // Fim da Função Gerenciar Visitante
    
    // Função incluir participantes
    
    void  incluir ()
    {
        static  int linha;
    
        int j, encontrou, tc, i, v;
        linha = 0 ;
    
        do {
    
           encontrou =0 ;
           tc =0 ;
    
           // Mostrar tela para digitação das informações do participante
    
           system ( " clear " );
           printf ( " \n \n \n \n \n \n \t \t \t \t \t \t \t *** Cadastro de Participantes *** \n \n \n " );
           printf ( " \n \t \t \t \t \t \t Nome ................................ ...: " );
           fflush (stdin);
           scanf("%[^\n]s%*c",nome[linha]);
    
    
           printf ( " \n \t \t \t \t \t \t Número do CPF ..........................: " );
           scanf ( "%d " , & cpf [linha]);
           printf ( " \n \t \t  \t \t \t \t Data de nascimento .....................: " );
           scanf ( "%d " , & datanasc [linha]);
           printf ( " \n \t \t \t \t \t \t E-mail .............................. ...: " );
           fflush (stdin);
           scanf ("%[^\n]s%*c", email[linha]);
           printf ( " \n \t \t \t \t \t \t É convidado do palestrante (S / N)? .....: " );
           scanf( "%[^\n]s%*c" , convidado[linha]);
           printf ( " \n \t \t \t \t \t \t Necessita de lugar especial (S / N)? ....: " );
           scanf( "%[^\n]s%*c", especial[linha]);
    
           // Verifica assentos reservados e reserva assento disponível
    
           system ( " clear " );
    
           // Assento Especial
           tc = strcmp (especial [linha], " S " );
           if (tc == 0 )
           {
            for (j = 0 ; j < 3 ; j++)
              {
               if (status [j] == 0 )
                {
                   printf ( " \n \n \n \n \n \n \t \t \t \t \t \t Olá %s " , nome [linha]);
                   printf ( " \n \n \t \t \t \t \t \t Seu assento é número: % d " , j + 1 );
                   printf ( " \n \n \t \t \t \t \t \t Esperamos que aproveite a Paletra !!! " );
                   status [j] = 1 ;
                   cpf [j] = cpf [linha];
                   getchar ();
                   j = 3 ;
                   encontrou = 1 ;
                   op = 0 ;
                }
              }
           }
    
           //outro
           {
           // Convidado do Palestrante
           tc = strcmp (convidado [linha], " S " );
           if (tc == 0 )
           {
              for (j = 3 ; j < 13 ; j ++)
              {
                if (status [j] == 0 )
                {
                   printf ( " \n \n \n \n \n \n \t \t \t \t \t \t Olá %s " , nome [linha]);
                   printf ( " \n \n \t \t \t \t \t \t Seu assento é número: % d " , j + 1 );
                   printf ( " \n \n \t \t \t \t \t \t Esperamos que aproveite a Paletra !!! " );
                   status [j] = 1 ;
                   cpf [j] = cpf [linha];
                   getchar ();
                   j = 14 ;
                   encontrou = 1 ;
                   op = 0 ;
                }
              }
           }
           //outro
           {
    
           // Participante
    
              for (j = 13 ; j < 52 ; j ++)
              {
                // i = pt [j];
                if (status [j] == 0 )
                {
                   printf ( " \n \n \n \n \n \n \t \t \t \t \t \t Olá %s " , nome[linha]);
                   printf ( " \n \n \t \t \t \t \t \t Seu assento é número: % d " , j + 1 );
                   printf ( " \n \n \t \t \t \t \t \t Esperamos que aproveite a Paletra !!! " );
                   cpf [j] = cpf [linha];
                   status [j] = 1 ;
                   getchar ();
                   j = 53 ;
                   encontrou = 1 ;
                   op = 0 ;
                }
              }
           }
    
        }
        if (encontrou == 0 )
        {
           printf ( " *** Todos os assentos estão ocupados! *** " );
           getchar ();
        }
    
        linha ++;
        printf ( " % d  % d " , cpf [linha], linha);
        } while(op == 1 );
    } // Fim da função incluir
    
    // Excluir participante liberando o assento
    void  excluir ()
    {
        int cpfPesquisa;
        int i;
    
        system ( " clear " );
        printf ( " \n \n \n \n \n \n \t \t \t \t \t \t \t Informe o CPF do participante que deseja excluir: " );
        scanf ( "%d" , & cpfPesquisa);
          for (i = 0 ; i <SIZE; i++)
        {
           if (cpf [i] == cpfPesquisa)
           {
              status [i] = 0 ;
              cpf [i] = 0 ;
              datanasc [i] = 0 ;
              i = 54 ;
              printf ( " \n \n \n \t \t \t \t \t \t \t *** Registro excluído com sucesso! *** " );
              getchar ();
           }
        }
    } // Fim da função excluir participante
    
    
    // Função Listar lugares livres no auditório
    
    void  listar_livres ()
    {
        int j;
    
        system ( " clear " );
        printf ( " \n \n \n \n \n \n \t \t \t \t \t \t \t *** Lugares Livres *** \n \n \n " );
        encontrou = 0 ;  // Bandeira para saber se existe pelo menos um assento livre
    
        printf ( " \n \n \n \t \t \t \t \t \t Assentos Especiais \n \n " );
        printf ( " \t \t \t \t \t \t Fileira A " );
          for (j = 0 ; j < 3 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "%d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Assentos para Convidados do Palestrante \n \n " );
        printf ( " \t \t \t \t \t \t Fileira B " );
          for (j = 3 ; j < 13 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "%d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Assentos para Participantes \n \n " );
        printf ( " \t \t \t \t \t \t Fileira C " );
          for (j = 13 ; j < 23 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "%d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( "\n" );
        printf ( " \t \t \t \t \t \t Fileira D " );
          for (j = 23 ; j < 33 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "% d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t Fileira E " );
          for (j = 33 ; j < 43 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "%d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( "\n" );
        printf ( " \t \t \t \t \t \t Fileira F " );
         for (j = 43 ; j < 53 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "%d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        getchar ();
     }
    
     // Função Lista todos os lugares do auditório
    
    void  listar_todos ()
    {
        int j;
        system ( " clear " );
    
        printf ( " \n \n \n \n \t \t \t \t \t \t \t      Todos os Lugares     \n " );
        printf ( " \t \t \t \t \t \t + ====================================== ============================ + " );
        encontrou = 0 ;  // Bandeira para saber se existe pelo menos um assento livre
        printf ( " \n \t \t \t \t \t \t \t   *** Livres ***   \n " );
        printf ( " \n \n \t \t \t \t \t \t Assentos Especiais \n " );
        printf ( " \t \t  \t \t \t \t A " );
          for (j = 0 ; j < 3 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "%d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Convidados do Palestrante \n " );
        printf ( " \t \t \t \t \t \t B " );
         for(j = 3 ; j < 13 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( "% d" , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Participantes \n " );
        printf ( " \t \t \t \t \t \t C " );
          for (j = 13 ; j < 23 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t D " ); 
            for (j = 23 ; j < 33 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t E " );
          for (j = 33 ; j < 43 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t F " );
          for (j = 43 ; j < 53 ; j ++)
        {
            if (status [j] == 0 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        // função para ver todos os ocupados
        printf ( " \n \n \n \t \t \t \t \t \t + ============================== ========================= + " );
        encontrou = 0 ;  // Bandeira para saber se existe pelo menos um assento livre
        printf ( " \n \t \t \t \t \t \t \t   *** Ocupados ***   \n " );
        printf ( " \n \t \t \t \t \t \t Assentos Especiais \n " );
        printf ( " \t \t \t \t \t \t A " );
            for (j = 0 ; j < 3 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 0 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Convidados do Palestrante \n " );
        printf ( " \t \t \t \t \t \t B " );
          for (j = 3 ; j < 13 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 0 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Participantes \n " );
        printf ( " \t \t \t \t \t \t C " );
          for (j = 13 ; j < 23 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t D " );
          for (j = 23 ; j < 33 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t E " );
          for (j = 33 ; j < 43 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t F " );
        for (j = 43 ; j < 53 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        getchar ();
    
    }
    
    
    void enviar_email ()   // erro nessa parte 
    {
    
            int opM;
        opM = 1 ;
    
        while (opM != 3 )
        {
            system ( " clear " );
           printf ( " \n \n \n \n \n \n \t \t \t \t \t \t + ======================== ============================================== + " );
           printf ( " \n \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | UNIP - UNIVERSIDADE PAULISTA | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 1 - Todos os Visitantes | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 2 - Escolher Visitante | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | 3 - Retornar ao Menu Principal | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t + ====================================== ============================== + \n \n " );
           printf ( " \t \t \t \t \t \t                   Digite a opção desejada ......: " );
           scanf ( "%d " , &opM);
    
                  switch (opM)
                {
    
                    case  1 :
                        email_todos ();
                        break ;
    
                    case  2 :
                        email_um ();
                        break ;
    
                    case  3 :
                       break ;
    
                    padrão :
                        printf ( " \n \t \t \t \t \t \t \t \t *** Opção Inválida! *** " );
                        getchar ();
                }
        }
    }
    
    void  email_todos ()
    {
    
            system ( " cls " );
           printf ( " \n \n \n \n \n \n \t \t \t \t \t \t + ======================== ============================================== + " );
           printf ( " \n \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | Palestra Direito Humanos | \n " );
           printf ( " \t \t \t \t \t \t | Dr. Ramiro | \n " );
           printf ( " \t \t \t \t \t \t | Contéudo da Palestra: Direitos Humanos | \n " );
           printf ( " \t \t \t \t \t \t | Motivo: Informativo | \n " );
           printf ( " \t \t \t \t \t \t | Data: 25/12/2020 Horário: 18:30 | \n " );
           printf ( " \t \t \t \t \t \t | Local: Unip - Chácara Santo Antônio | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | Resumo | \n " );
           printf ( " \t \t \t \t \t \t | Hoje em dia as pessoas torcem o nariz para palavra | \n " );
           printf ( " \t \t \t \t \t \t | ?? Direitos Humanos ??, pois aqui no Brasil ela sempre | \n " );
           printf ( " \t \t \t \t \t \t | sempre está ligada ao crime e violência e nunca | \n " );
           printf ( " \t \t \t \t \t \t | está ao lado da vítima, mas sim daquela | \n " );
           printf ( " \t \t \t \t \t \t | causaram o Dano. Porém o que ninguém sabe que | \n " );
           printf ( " \t \t \t \t \t \t | na década de 40 em uma reunião em paris, foram | \n " );
           printf ( " \t \t  \t \t \t \t | lançados 30 artigos no rastro da segunda guerra |  \n " );
           printf ( " \t \t \t \t \t \t | Mundial, pois a falta de punição contra governos | \n " );
           printf ( " \t \t \t \t \t \t | autoritários, trabalho escravo, tortura, discriminação, | \n " );
           printf ( " \t \t \t \t \t \t | fome e pobreza violava todos os dias a vida dos seres | \n " );
           printf ( " \t \t \t \t \t \t | humanos da época. | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t + ====================================== ============================== +  \n \n " );
           getchar ();
    }
    
    void  email_um ()
    {
        int as;
        printf ( " \t \t \t \t \t \t Escolha o Assento abaixo, Assim o e-mail será enviado para pessoa que está sentada no mesmo. \n " );
        encontrou = 0 ;  // Bandeira para saber se existe pelo menos um assento livre
        printf ( " \n \t \t \t \t \t \t Assentos Especiais \n " );
        printf ( " \t \t \t \t \t \t A " );
          for(j = 0 ; j < 3 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 0 ;
            }
        }
    
        printf ( " \n \n \n \t \t \t \t \t \t Convidados do Palestrante \n " );
        printf ( " \t \t \t \t \t \t B " );
        for (j = 3 ; j < 13 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 0 ;
            }
        }
    
        printf ( "  \n \n \n \t \t \t \t \t \t Participantes \n " );
        printf ( " \t \t \t \t \t \t C " );
        for (j = 13 ; j < 23 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t D " );
        for (j = 23 ; j < 33 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( "  \n" );
        printf ( " \t \t \t \t \t \t E " );
        for (j = 33 ; j < 43 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n " );
        printf ( " \t \t \t \t \t \t F " );
        for (j = 43 ; j < 53 ; j ++)
        {
            if (status [j] == 1 )
            {
                printf ( " [ % d ] " , j + 1 );
                encontrou = 1 ;
            }
        }
    
        printf ( " \n \t\t \t \t \t \t \t \t Necessário apenas o número do assento \n " );
        printf ( " \t \t \t \t \t \t \t \t Assento ......: " );
        scanf ( " %d " , &as);
    
        system ( " clear " );
        if (as> 0 && as < 54 ) {
    
           printf ( " \n \n \n \n " );
           printf ( " \n \n \n \n \t \t \t \t \t \t Assento: % d  \n " , as);
           printf ( " \t \t \t \t \t \t Email Enviado com Sucesso !!! \n \n " );
           printf ( " \t \t \t \t \t \t Conteúdo: \n " );
           printf ( " \t \t \t \t \t \t + ====================================== ============================== + " );
           printf ( " \n \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | Palestra Direito Humanos | \n " );
           printf ( " \t \t \t \t \t \t | Dr. Ramiro | \n " );
           printf ( " \t \t \t \t \t \t | Contéudo da Palestra: Direitos Humanos | \n " );
           printf ( " \t \t \t \t \t \t | Solicitação do Assento: % d                                | \n " , as);
           printf ( " \t \t \t \t \t \t | Motivo: Para Envio do Informativo | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | Data: 13/12/2018 Horário: 18:30 | \n " );
           printf ( " \t \t \t \t \t \t | Local: Unip - Chácara Santo Antônio | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t | Resumo | \n " );
           printf ( " \t \t \t \t \t \t | Hoje em dia as pessoas torcem o nariz para palavra | \n " );
           printf ( " \t \t \t \t \t \t | ?? Direitos Humanos ??, pois aqui no Brasil ela sempre | \n " );
           printf ( " \t \t \t \t \t \t | sempre está ligada ao crime e violência e nunca | \n " );
           printf ( " \t \t \t \t \t \t | está ao lado da vítima, mas sim daquela | \n " );
           printf ( " \t \t \t \t \t \t | causaram o Dano. Porém o que ninguém sabe que | \n " );
           printf ( " \t \t \t \t \t \t | na década de 40 em uma reunião em paris, foram | \n " );
           printf ( " \t \t \t \t \t \t | lançados 30 artigos no rastro da segunda guerra | \n " );
           printf ( " \t \t \t \t \t \t | Mundial, pois a falta de punição contra governos | \n " );
           printf ( " \t \t \t \t \t \t | autoritários, trabalho escravo, tortura, discriminação, | \n " );
           printf ( " \t \t \t \t \t \t | fome e pobreza violava todos os dias a vida dos seres | \n " );
           printf ( " \t  \t \t \t \t \t | humanos da época. | \n " );
           printf ( " \t \t \t \t \t \t | | \n " );
           printf ( " \t \t \t \t \t \t + ====================================== ============================== + \n \n " );
    
           getchar ();
    
        }
        else {
           printf ( " \t \t \t \t \t \t Assento Inválido \n " );
           getchar ();
        }
           getchar ();
    
    }
    
    void  realizar_sorteio ()
    {
        srand (time(0)); // escolhe sequencia de numeros aleatorios
        int valores [] = { 1 , 2 , 3 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 ,38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 };
        int n = sizeof valores / sizeof * valores;
        n =rand()%53;
        printf ( " \t \t \t \t \t \t \t \t + ================================== == + \n " );
        printf ( " \t \t \t \t \t \t \t \t PARABÉNS !!!! \n " );
        printf ( " \t \t \t \t \t \t \t \t *** Assento: % d *** \n " , valores [ rand ()%n]);
        printf ( " \t  \t \t \t \t \t \t \t Você foi Sorteado !!!!! " );
        getchar ();
    }

     

    • Amei 1
  5. #define _CRT_SECURE_NO_WARNINGS
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>
    
    
    int main()
    {
        char login[] = "adm";
        char nome[10], senha[10], nomeptc[40], email[40];
        char password[] = "adm";
        char rg[10], dtn[15];
        int v, l, qtd, qtd2, nassento;
        int op, cadeiras[55], status[55], i, ncadeira, encontrou;
        time_t data_tempo;
        time(&data_tempo);
        struct tm* tempo = localtime(&data_tempo);
        struct tm* data = localtime(&data_tempo);
        qtd = 0;
        qtd2 = 0;
        for (i = 0; i < 55; i++)
        {
            cadeiras[i] = i + 1;
            status[i] = 0;
        }
        for (i = 0; i < 55; i++)
        {
            status[i] = 0;
            status[i] = i + 1;
        }
        op = 1;
        while (qtd != 3 || qtd2 != 3)
        {
            system("clear");
            printf(" LOGIN: ");
            scanf("%s", nome);
            l = strcmp(login, nome);
            if (l == 0) {
                printf(" SENHA: ");
                scanf("%s", senha);
                v = strcmp(password, senha);
                
                printf("Digite a quantidade de assentos:");
                scanf("%d%*c", &nassento);
                
                if (v == 0)
                {   
                    
                    
                    
                    while (op != 4) {
                        system("clear");
                        printf("\n       MENU PRINCIPAL    \n");
                        printf("-------------------------\n");
                        printf("| 1 | Gerenciar Visitante\n");
                        printf("-------------------------\n");
                        printf("| 2 | Realizar sorteio  \n");
                        printf("-------------------------\n");
                        printf("| 3 |     E-mail         \n");
                        printf("-------------------------\n");
                        printf("| 4 |    Sair\n");
                        printf("-------------------------\n");
                        printf("Escolha uma das opções acima:");
                        scanf("%d", &op);
                        switch (op)
                        {
                        case 1:
                            system("clear");
                            while (op != 7)
                            {
                                system("clear");
                                printf("    O PODER DA TECOLOGIA   \n");
                                printf("---------------------------\n");
                                printf("| 1 | Incluir Participante \n");
                                printf("---------------------------\n");
                                printf("| 2 | Excluir Participante \n");
                                printf("---------------------------\n");
                                printf("| 3 | Alocar aluno         \n");
                                printf("---------------------------\n");
                                printf("| 4 | Lugares ocupadas     \n");
                                printf("---------------------------\n");
                                printf("| 5 | Lugares livres       \n");
                                printf("---------------------------\n");
                                printf("| 6 | Listar todas  lugares\n");
                                printf("---------------------------\n");
                                printf("| 7 | Retornar             \n");
                                printf("---------------------------\n");
                                printf("Escolha sua opcao: ");
                                scanf("%d%*c", &op);
                                switch (op)
                                {
                                case 1:
                                    system("clear");
    
                              
                                    printf("Digite o numero do assento desejado: ");
                                    scanf("%d%*c", &ncadeira);
    
                                    printf("Digite seu nome: ");
                                    scanf("%[^\n]s%*c", nomeptc);
                                    getchar();
                                      
                                    fflush(stdin);
                                    printf("\nDigite seu RG: ");
                                    scanf("%s%*c", rg);
    
                                    
                                    printf("\nDigite sua Data de Nascimento: ");
                                    scanf("%s%*c", dtn);
                                    
                                    fflush(stdin);
                                    printf("\nDigite o E-mail: ");
                                    scanf("%s%*c", email );
    
    
                                    printf("\nHora: %i:%i", tempo->tm_hour, tempo->tm_min);
                                    printf("\nData: %d/%d/%d \n", data->tm_mday, data->tm_mon, data->tm_year);
                                    system("pause");
                                    if (status[ncadeira - 1] == 1) {
                                        printf("Assento ja reservado. Verifique outro lugar.");
                                        system("clear");
                                    }
                                    // Aqui será feito o cadastro do Participante
                                    else {
                                        for (i = 0; i < 55; i++)
                                        {
                                            if (ncadeira == cadeiras[i])
                                            {
                                                status[i] = 1;
                                                printf("-------------------------------------\n");
                                                printf("Assento reservado com sucesso!\n");
                                                printf("Bem Vindo Sr.(a) %s\n", nomeptc);
                                                printf("E-mail de Contato: %s\n", &email[i]);
                                                printf("Seu numero de assento: %p \n", &ncadeira);
                                                printf("--------------------------------------\n");
                                             
                                            }
                                        };
                                        system("clear");
                                    }
                                    break;
                                    // Aqui é a parte que verifica se tem lugar disponível e se tiver o cadastro é efetuado.
    
                                case 2:
                                    system("clear");
                                    printf("Informe o numero do lugar que deseja liberar: ");
                                    scanf("%d", &ncadeira);
                                    if (status[ncadeira - 1] == 0)
                                    {
                                        status[i] = 0;
                                        printf("Liberacao realizada com sucesso!");
                                        system("pause");
                                    }
    
                                    break;
                                    // Aqui é onde deveria liberar uma cadeira ocupada.
    
    
                                case 3:
                                    i = 0;
                                    encontrou = 0;
                                    while (i < 55)
                                    {
                                        if (status[i] == 0)
                                        {
                                            status[i] = 1;
                                            printf("O cliente foi alocado no lugar: %d", cadeiras[i]);
                                            system("pause");
                                            i = 10;
                                            encontrou = 1;
                                        }
                                        i++;
                                    }
                                    if (encontrou == 0)
                                    {
                                        printf("Nao existe lugar disponivel!\n");
                                        system("pause");
                                        break;
                                    }
                                    //Aqui é para Alocar o Participante em um lugar aleatório que não esteja ocupado
    
                                case 4:
    
                                    system("clear");
                                    printf("ASSENTOS OCUPADOS\n");
                                    printf("=============\n\n");
                                    printf("Assento Status\n\n");
                                    encontrou = 0;
                                    for (i = 0; i < 55; i++)
                                    {
                                        if (status[i] == 1)
                                        {
                                            printf("%d Ocupado\n", cadeiras[i]);
                                            encontrou = 1;
                                        }
                                    }
                                    if (encontrou == 0)
                                    {
                                        printf("Todas os Assentos estão Livres\n");
                                    }
                                    system("pause");
                                    break;
                                    // Aqui é listados todos os lugares que ja foram ocupados.
    
    
                                case 5:
                                    system("clear");
                                    printf("ASSENTOS LIVRES\n");
                                    printf("==============\n\n");
                                    printf("Assentos Status\n\n");
                                    encontrou = 0;
                                    for (i = 0; i < 55; i++)
                                    {
                                        if (encontrou == 0)
                                        {
                                            printf("%d Livre\n", cadeiras[i]);
                                            encontrou = 1;
                                        }
                                    }
                                    if (encontrou == 1)
                                    {
                                        printf("Todos os assentos estão Ocupados\n");
                                    }
                                    system("pause");
                                    break;
                                    //Aqui deveria mostrar toos os lugares livres.
    
    
                                case 6:
                                    system("clear");
                                    printf("TODOS OS ASSENTOS\n");
                                    printf("==============\n\n");
                                    printf("Assento  Status\n\n");
                                    encontrou = 0;
                                    for (i = 0; i < 55; i++)
                                    {
                                        if (status[i] == 1)
                                        {
                                            printf("%d Ocupado\n", cadeiras[i]);
                                        }
                                        else
                                        {
                                            printf("%d Livre\n", cadeiras[i]);
                                        }
                                    }
                                    system("pause");
                                    break;
                                    //Aqui Mostra todos os lugares independente da situação.
    
    
                                case 7:
                                   //system("clear");
                                   // op = 0;
                                    break;// Nesta Parte deveria retornar ao primeiro Menu.
                                }
                            }
                        case 2:
                           system("clear");
                            srand(time(NULL));
                            printf("Realizando sorteio...\n");
                            cadeiras[i] = rand() % 100;
                            printf("\nParabens!!!\n Participante Sorteado: %d \n", cadeiras[i]);
    
    
                            system("pause");
    
                        case 4:
                            break;
                        }
                    }
                }
                else {
                    printf("senha incorreta!");
                    qtd = qtd + 1;
                    system("pause");
                }
    
                if (qtd == 3)
                {
                    system("clear");
                    printf("Acesso Negado!");
                    system("pause");
                }
            }
            else
            {
                printf("login invalido \n \n");
                qtd = qtd2 + 1;
                system("pause");
            }
            if (qtd2 == 3)
            {
               system("clear");
                printf("Acesso Negado!");
                system("pause");
            }
        }
    
    
    };

     

    O Codigo nao executa os passos do segundo menu 

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!