TrabalhosGratuitos.com - Trabalhos, Monografias, Artigos, Exames, Resumos de livros, Dissertações
Pesquisar

Cadastro Cpp Em C++

Exames: Cadastro Cpp Em C++. Pesquise 860.000+ trabalhos acadêmicos

Por:   •  7/12/2014  •  526 Palavras (3 Páginas)  •  403 Visualizações

Página 1 de 3

#include <iostream>

#include <iomanip>

#include <fstream>

#include <cstring>

#include <cctype>

#include <cstdlib>

#include <stdlib.h>

using namespace std;

struct cad_alunos{

int nr;

char nome[50];

float media;

int status;

}alunos[3];

int cadastrar();

int ler();

int main()

{

system("cls");

int resp;

cout<<"**************************************************\n";

cout<<" 1 para cadastrar \n";

cout<<" 2 para Ler \n";

cout<<" 3 para sair \n";

cout<<"**************************************************\n";

cout<<"Digite uma opcao:";

cin>> resp;

if (resp==1)

{

cadastrar();

}else if (resp==2)

{

ler();

}else

{

EXIT_SUCCESS;

}

return 0;

}

int cadastrar()

{

system("cls");

fflush(stdin);

int I;

ofstream ARQBIN;

ARQBIN.open("MATFLO.DBC", ios_base:: binary);

for(I=0;I<3;I++)

{

fflush(stdin);

cout<< "\nDigite o elemento "<<I<< ":";

cin>> alunos[I].nr;

fflush(stdin);

cout<< "\nDigite o nome "<<I<< ":";

cin.getline(alunos[I].nome, sizeof(alunos[I].nome)) ;

cout<< "\nDigite a media " <<I<< ":";

cin>> alunos[I].media;

}

ARQBIN.write(reinterpret_cast<char*>(&alunos[I].nr), sizeof(alunos[I].nr));

ARQBIN.write(reinterpret_cast<char*> (&alunos[I].nome), sizeof(alunos[I].nome));

ARQBIN.write(reinterpret_cast<char*>

...

Baixar como (para membros premium)  txt (2.6 Kb)  
Continuar por mais 2 páginas »
Disponível apenas no TrabalhosGratuitos.com