Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- # define Linhas 10
- # define Colunas 2
- typedef struct
- {
- int ra;
- char nome[50];
- }tAlunos;
- void lerDados(tAlunos *v[Linhas][Colunas]);
- int main(int argc, char *argv[])
- {
- tAlunos alunos[Linhas][Colunas];
- int opcao;
- printf("\n * Inserir alunos e mante-los ordenados pelo RA *\n");
- printf("_______________________________________________________________________________\n\n");
- printf(" Escolha a opcao:\n\n\n");
- printf(" Opcao 1: Inserir um novo registro.\n\n");
- printf(" Opcao 2: Listar todos os registros da tabela.\n\n");
- printf(" Opcao 3: Encerrar a execucao.\n");
- printf("_______________________________________________________________________________\n\n");
- do
- {
- printf(" Digite a opcao [ 1, 2 ou 3 ]: ");
- scanf("%d", &opcao);
- printf("\n");
- switch (opcao)
- {
- case 1:
- lerDados (&alunos);
- break;
- }
- }
- while (opcao < 3);
- system("PAUSE");
- return 0;
- }
- void lerDados (tAlunos *v[Linhas][Colunas])
- {
- int i, j;
- for (i = 0; i < Linhas; i++)
- {
- printf(" Digite os nomes da %do. aluno\n\n", i+1);
- fflush(stdin);
- gets(v[i][j]->nome);
- printf("\n");
- for (j = 0; j < Colunas; j++)
- {
- printf(" O ra do %do. aluno = ", i+1);
- scanf("%d", &v[i][j]->ra);
- printf("\n");
- }
- }
- }
Add Comment
Please, Sign In to add comment