Ir para conteúdo
Fórum Script Brasil

p.omael98

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Sobre p.omael98

p.omael98's Achievements

0

Reputação

  1. Preciso de ajuda, consegui fazer o programa ate aqui, mas não sei continuar, alguém pode me ajudar ? Ele tem que conter: Excluir um aluno; Pesquisar um aluno por matricula; (Agradeço muito se me ajudarem) #include<iostream> #include<string> #include<locale.h> using namespace std; #define totalAlunos 10 //DEFINE O TOTAL DE ALUNOS PARA UM VALOR CONSTANTE. USEM ESSA CONSTANTE PARA O VALOR MAXIMO DE UM LAÇO. struct dadosAluno{ string nome = " "; float matricula = 0; float av1 = 0; float av2 = 0; float av3 = 0; float mediaF = 0; // MEDIA FINAL }aluno[totalAlunos];//STRUCT DOS DADOS DE TODOS OS ALUNOS //SISTEMA DAS FUNÇÕES void exibeOpcoes(void); //EXIBE AS OPÇÕES int posicaoVazia(void); //BUSCA A POSIÇÃO VAZIA PARA GRAVAR UM ALUNO void inserirAluno(void);//INSERE UM ALUNO void inserirAv1(void);//INSERE NOTA AV1 void inserirAv2(void);//INSERE NOTA AV2 void inserirAv3(void);//INSERE NOTA AV3 void menu (void); //MENU void mediaFinal(void); void editarAluno(void); void excluirAluno(void); void pesquisarAluno(void); //MOSTRA OS DADOS DO ALUNO INFORMADO (NOME, MATRICULA, AV1, AV2, AV3) void exibirNotas(void); // EXIBE NOTAS AV1, AV2 E AV3 void exibirSituacaoF(void); //EXIBE A MEDIA E A SITUAÇÃO DO ALUNO APROVADO OU REPROVADO void e_Alunosav3(void); //EXIBE ALUNOS QUE FICARAM EM AV3 void mediaFinal(void); // EXIBE A MEDIA FINAL void editAv1(void); void editAv2(void); void editAv3(void); void editNome(void); int main(void) { setlocale (LC_ALL, "portuguese"); menu(); }//FIM DO INT MAIN //MENU void menu (void) { int x = 0; int op = -1; while (op != 0)//LAÇO DE REPETIÇÃO DAS OPÇÕES { exibeOpcoes(); cin >> op; system ("CLS"); switch (op) { case 0 : cout << "Encerrando o programa"; break; case 1 : inserirAluno(); break; case 2 : editarAluno(); break; case 3 : excluirAluno(); break; case 4 : pesquisarAluno(); break; case 5 : inserirAv1(); break; case 6 : inserirAv2(); break; case 7 : inserirAv3(); break; case 8 : exibirNotas(); break; case 9 : exibirSituacaoF(); break; case 10 : e_Alunosav3(); break; default : cout << "Opção invalida!"<<endl<<endl; } } } void exibeOpcoes(void) //EXIBE O MENU DE OPÇÕES { cout << "Opções disponiveis:" <<endl<<endl; cout << "1 - Inserir um aluno."<<endl; cout << "2 - Editar um aluno."<<endl; cout << "3 - Excluir um aluno."<<endl; cout << "4 - Pesquisar um aluno por matrícula."<<endl; cout << "5 - Digitar notas de AV1."<<endl; cout << "6 - Digitar notas de AV2."<<endl; cout << "7 - Digitar notas de AV3."<<endl; cout << "8 - Exibir notas dos alunos."<<endl; cout << "9 - Exibir situação final."<<endl; cout << "10 - Exibir alunos em AV3."<<endl; cout << "0 - Sair"<<endl<<endl; cout << "Digite a opção desejada: "; }//FIM DO EXIBE MENU opções //BUSCA A POSIÇÃO QUE ESTÁ VAZIA PARA GRAVAR UM ALUNO int posicaoVazia(void) // METODO DE VERIFICAR SE TEM ESPAÇO PARA CADASTRAR O ALUNO { int x; for (x=0; x<totalAlunos; x++){ if(aluno[x].matricula == 0){break;} } if (x==totalAlunos) return -1; else return x; }//FIM DO BUSCAR POSIÇÃO VAZIA void inserirAluno(void) //INSERE UM ALUNO { int posicao, x, y; posicao = posicaoVazia(); if (posicao == -1) { cout<<"Não é possivel inserir mais nenhum aluno. Exclua ou edite um aluno para continuar."<<endl; cout<<"Exclua ou edite um aluno para continuar."<<endl<<endl; } else { do { y=1; cout << "Digite o nome do aluno: "; cin >> aluno[posicao].nome; cout << "Digite a matricula do aluno: "; cin >> aluno[posicao].matricula; system("CLS"); for (x=0; x<totalAlunos; x++) // METODO QUE VERIFICA SE A MATRICULA JÁ FOI CADASTRADA { if (posicao != x) { if (aluno[posicao].matricula == aluno[x].matricula) { cout<<"A matricula "<<aluno[posicao].matricula<<" já pertence a um aluno."<<endl; cout<<"Por favor informe outra matricula!"<<endl<<endl; y=0; } } } }while(y==0); cout << "O Aluno: "<<aluno[posicao].nome<<endl; cout << "Matrícula: "<<aluno[posicao].matricula<<endl; cout << "Foi cadastrado com sucesso!"<<endl<<endl; } }//FIM DO INSERIR ALUNO void editarAluno(void) // JONATAS { float buscaAv, nota=0; float m = 0; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout<<"A seguir edite as informações:\n"; cout<<"Digite a matricula: \n"; cout<<"Digite o nome do aluno:\n"; inserirAv1(); inserirAv2(); inserirAv3(); cout<<"Os dados foram alterados!"; } } void excluirAluno(void) //AQUI PAULO { } void pesquisarAluno() //AQUI PAULO { } void inserirAv1(void) //INSERE A AV1 { float buscaAv, nota=0; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout << "Aluno: "<<aluno[busca].nome<<endl; cout << "Matrícula: "<<aluno[busca].matricula<<endl; cout << "Digite a nota da AV1: "; cin >> nota; if(nota>=0 && nota<=10) { if(nota<4) { aluno[busca].av1 = 0; } else { aluno[busca].av1 = nota; } cout<<"Nota Gravada com sucesso!"<<endl<<endl; } else { cout<<"Nota inválida!"<<endl<<endl; } } }//FIM DO INSERE AV1 void inserirAv2(void) //INSERE A AV2 { float buscaAv, nota; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout << "Aluno: "<<aluno[busca].nome<<endl; cout << "Matrícula: "<<aluno[busca].matricula<<endl; cout << "Digite a nota da AV2: "; cin >> nota; if(nota>=0 && nota<=10) { if(nota<4) { aluno[busca].av2 = 0; } else { aluno[busca].av2 = nota; } cout<<"Nota Gravada com sucesso!"<<endl<<endl; } else { cout<<"Nota inválida!"<<endl<<endl; } } }//FIM DO INSERE AV2 void inserirAv3(void) //INSERE A AV3 { float buscaAv, nota=0; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout << "Aluno: "<<aluno[busca].nome<<endl; cout << "Matrícula: "<<aluno[busca].matricula<<endl; cout << "Digite a nota da AV3: "; cin >> nota; if(nota>=0 && nota<=10) { if(nota<4) { aluno[busca].av3 = 0; } else { aluno[busca].av3 = nota; } cout<<"Nota Gravada com sucesso!"<<endl<<endl; } else { cout<<"Nota inválida!"<<endl<<endl; } } }//FIM DO INSERE AV3 void mediaFinal(void) // AQUI WELL { } void exibirNotas(void) // AQUI WELL { } void exibirSituacaoF(void) { } void e_Alunosav3(void) { }
  2. Preciso de ajuda, consegui fazer o programa ate aqui, mas não sei continuar, alguém pode me ajudar ? Ele tem que conter: Excluir um aluno; Pesquisar um aluno por matricula; (Agradeço muito se me ajudarem) #include<iostream> #include<string> #include<locale.h> using namespace std; #define totalAlunos 10 //DEFINE O TOTAL DE ALUNOS PARA UM VALOR CONSTANTE. USEM ESSA CONSTANTE PARA O VALOR MAXIMO DE UM LAÇO. struct dadosAluno{ string nome = " "; float matricula = 0; float av1 = 0; float av2 = 0; float av3 = 0; float mediaF = 0; // MEDIA FINAL }aluno[totalAlunos];//STRUCT DOS DADOS DE TODOS OS ALUNOS //SISTEMA DAS FUNÇÕES void exibeOpcoes(void); //EXIBE AS OPÇÕES int posicaoVazia(void); //BUSCA A POSIÇÃO VAZIA PARA GRAVAR UM ALUNO void inserirAluno(void);//INSERE UM ALUNO void inserirAv1(void);//INSERE NOTA AV1 void inserirAv2(void);//INSERE NOTA AV2 void inserirAv3(void);//INSERE NOTA AV3 void menu (void); //MENU void mediaFinal(void); void editarAluno(void); void excluirAluno(void); void pesquisarAluno(void); //MOSTRA OS DADOS DO ALUNO INFORMADO (NOME, MATRICULA, AV1, AV2, AV3) void exibirNotas(void); // EXIBE NOTAS AV1, AV2 E AV3 void exibirSituacaoF(void); //EXIBE A MEDIA E A SITUAÇÃO DO ALUNO APROVADO OU REPROVADO void e_Alunosav3(void); //EXIBE ALUNOS QUE FICARAM EM AV3 void mediaFinal(void); // EXIBE A MEDIA FINAL void editAv1(void); void editAv2(void); void editAv3(void); void editNome(void); int main(void) { setlocale (LC_ALL, "portuguese"); menu(); }//FIM DO INT MAIN //MENU void menu (void) { int x = 0; int op = -1; while (op != 0)//LAÇO DE REPETIÇÃO DAS OPÇÕES { exibeOpcoes(); cin >> op; system ("CLS"); switch (op) { case 0 : cout << "Encerrando o programa"; break; case 1 : inserirAluno(); break; case 2 : editarAluno(); break; case 3 : excluirAluno(); break; case 4 : pesquisarAluno(); break; case 5 : inserirAv1(); break; case 6 : inserirAv2(); break; case 7 : inserirAv3(); break; case 8 : exibirNotas(); break; case 9 : exibirSituacaoF(); break; case 10 : e_Alunosav3(); break; default : cout << "Opção invalida!"<<endl<<endl; } } } void exibeOpcoes(void) //EXIBE O MENU DE OPÇÕES { cout << "Opções disponiveis:" <<endl<<endl; cout << "1 - Inserir um aluno."<<endl; cout << "2 - Editar um aluno."<<endl; cout << "3 - Excluir um aluno."<<endl; cout << "4 - Pesquisar um aluno por matrícula."<<endl; cout << "5 - Digitar notas de AV1."<<endl; cout << "6 - Digitar notas de AV2."<<endl; cout << "7 - Digitar notas de AV3."<<endl; cout << "8 - Exibir notas dos alunos."<<endl; cout << "9 - Exibir situação final."<<endl; cout << "10 - Exibir alunos em AV3."<<endl; cout << "0 - Sair"<<endl<<endl; cout << "Digite a opção desejada: "; }//FIM DO EXIBE MENU opções //BUSCA A POSIÇÃO QUE ESTÁ VAZIA PARA GRAVAR UM ALUNO int posicaoVazia(void) // METODO DE VERIFICAR SE TEM ESPAÇO PARA CADASTRAR O ALUNO { int x; for (x=0; x<totalAlunos; x++){ if(aluno[x].matricula == 0){break;} } if (x==totalAlunos) return -1; else return x; }//FIM DO BUSCAR POSIÇÃO VAZIA void inserirAluno(void) //INSERE UM ALUNO { int posicao, x, y; posicao = posicaoVazia(); if (posicao == -1) { cout<<"Não é possivel inserir mais nenhum aluno. Exclua ou edite um aluno para continuar."<<endl; cout<<"Exclua ou edite um aluno para continuar."<<endl<<endl; } else { do { y=1; cout << "Digite o nome do aluno: "; cin >> aluno[posicao].nome; cout << "Digite a matricula do aluno: "; cin >> aluno[posicao].matricula; system("CLS"); for (x=0; x<totalAlunos; x++) // METODO QUE VERIFICA SE A MATRICULA JÁ FOI CADASTRADA { if (posicao != x) { if (aluno[posicao].matricula == aluno[x].matricula) { cout<<"A matricula "<<aluno[posicao].matricula<<" já pertence a um aluno."<<endl; cout<<"Por favor informe outra matricula!"<<endl<<endl; y=0; } } } }while(y==0); cout << "O Aluno: "<<aluno[posicao].nome<<endl; cout << "Matrícula: "<<aluno[posicao].matricula<<endl; cout << "Foi cadastrado com sucesso!"<<endl<<endl; } }//FIM DO INSERIR ALUNO void editarAluno(void) // JONATAS { float buscaAv, nota=0; float m = 0; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout<<"A seguir edite as informações:\n"; cout<<"Digite a matricula: \n"; cout<<"Digite o nome do aluno:\n"; inserirAv1(); inserirAv2(); inserirAv3(); cout<<"Os dados foram alterados!"; } } void excluirAluno(void) //AQUI PAULO { } void pesquisarAluno() //AQUI PAULO { } void inserirAv1(void) //INSERE A AV1 { float buscaAv, nota=0; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout << "Aluno: "<<aluno[busca].nome<<endl; cout << "Matrícula: "<<aluno[busca].matricula<<endl; cout << "Digite a nota da AV1: "; cin >> nota; if(nota>=0 && nota<=10) { if(nota<4) { aluno[busca].av1 = 0; } else { aluno[busca].av1 = nota; } cout<<"Nota Gravada com sucesso!"<<endl<<endl; } else { cout<<"Nota inválida!"<<endl<<endl; } } }//FIM DO INSERE AV1 void inserirAv2(void) //INSERE A AV2 { float buscaAv, nota; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout << "Aluno: "<<aluno[busca].nome<<endl; cout << "Matrícula: "<<aluno[busca].matricula<<endl; cout << "Digite a nota da AV2: "; cin >> nota; if(nota>=0 && nota<=10) { if(nota<4) { aluno[busca].av2 = 0; } else { aluno[busca].av2 = nota; } cout<<"Nota Gravada com sucesso!"<<endl<<endl; } else { cout<<"Nota inválida!"<<endl<<endl; } } }//FIM DO INSERE AV2 void inserirAv3(void) //INSERE A AV3 { float buscaAv, nota=0; cout << "Informe a matricula do aluno: "; cin >> buscaAv; system("CLS"); int busca = -1; int x; for(x=0; x<totalAlunos; x++) { if(aluno[x].matricula == buscaAv) { busca = x; break; } } if(busca == -1) { cout << "A matrícula não existe."<<endl; cout << "Por favor informe uma matrícula válida."<<endl<<endl; } else { cout << "Aluno: "<<aluno[busca].nome<<endl; cout << "Matrícula: "<<aluno[busca].matricula<<endl; cout << "Digite a nota da AV3: "; cin >> nota; if(nota>=0 && nota<=10) { if(nota<4) { aluno[busca].av3 = 0; } else { aluno[busca].av3 = nota; } cout<<"Nota Gravada com sucesso!"<<endl<<endl; } else { cout<<"Nota inválida!"<<endl<<endl; } } }//FIM DO INSERE AV3 void mediaFinal(void) // AQUI WELL { } void exibirNotas(void) // AQUI WELL { } void exibirSituacaoF(void) { } void e_Alunosav3(void) { }
×
×
  • Criar Novo...