Jump to content


Photo

Agenda Em C/c++


  • Faça o login para participar
4 replies to this topic

#1 linkzone

linkzone

    Turista

  • Usuários
  • 44 posts
  • Sexo:Não informado

Posted 16/10/2004, 00:25

Alguem tem o codigo em C/C++ de uma agenda de telefone?
OFF-LINE 4EVER!

#2 xg0rd0

xg0rd0

    Novato no fórum

  • Usuários
  • 21 posts
  • Sexo:Não informado

Posted 17/10/2004, 02:16

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <complex.h>
#include <math.h>
#include <string.h>
#include <fstream.h>
#include <malloc.h>
#include<conio.h>
#include<stdio.h>
// COMECANDO C++ ORIENTADO A OBJETOS, PROJETO AGENDA
// POR DIOGO CEZAR TEIXEIRA BATISTA
// AGENDA G0 1.02 - C++
class agenda
{
private:
	char nome[50];
	char end[50];
	char tel[50];
	char ema[50];
	char buff[50];
	int op;
	int i;
	int s;
	int count;
	int cad;
public:
	void novoreg();
	void consulta();
	void mostrar();
	void apagar();

// FIM DAS DECLARACOES DO CLASS, ELE ARMAZENAS AS VAIRAVEIS
// PUBLIC EH USADO EM TODO DOCUMENTO, E PRIVATE SOH PARA AGENDA
};
void agenda::novoreg()
{
  ofstream fout;
  fout.open("c:\\Agenda.txt", ios::ate | ios:: app);
  agenda ag; // CHAMANDO O CLASS...
  clrscr();
  printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
  cprintf("\n                                 NOME : ");
  flushall();
  gets(nome);// DEBUG, SEM MOTIVO CONHECIDO

  fout << nome << endl;
  textcolor(14); cprintf("\n ENDERECO : ");
  gets(end);
  fout << end << endl;
  textcolor(14); cprintf("\n TELEFONE : ");
  gets(tel);
  fout << tel << endl;
  textcolor(14); cprintf("\n E-MAIL : ");
  gets(ema);
  fout << ema << endl;
  printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  textcolor(14); cprintf("\n REGISTRO INCLUIDO ! ");
  textcolor(15);
  printf("\n Digite ");
  textcolor(14); cprintf("5 ");
  textcolor(15);
  printf("para VOLTAR, ");
  textcolor(14); cprintf("4 ");
  textcolor(15);
  printf("para SAIR ou ");
  textcolor(14); cprintf("6 ");
  textcolor(15);
  cad = 1;
  printf("para um NOVO registro : ");
  scanf("%d", &op);
  // CHAMANDO OS VOIDS PELOS IF'S...
 	 if ( op == 5 )
    {
   	 ag.mostrar();
    }
 	 else if ( op == 6 )
    {
   	 ag.novoreg();
    }
}
void agenda::consulta()
{
  agenda ag; // CHAMANDO O CLASS...
  clrscr();
  ifstream fout;
  fout.open("c:\\Agenda.txt");
  fout.seekg(0);
  i=1;
  count=0;
  printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
  textcolor(15);
  while(fout.getline(buff,50))
   {
    if( s != 1 )
    {
     if ( i<0 || i>4)
      {
        count++;
        textcolor(14); cprintf("\n Registro n£mero -> %d", count);
        textcolor(15);
        printf("\n Gostaria de ver o pr¢ximo ? [ ");
        textcolor(14); cprintf("S ");
        printf("/");
        textcolor(14); cprintf(" N");
        printf(" ]");
        textcolor(15);
       	 if (getche() == 's')
       	 {
         	 clrscr();
         	 printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
         	 textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
         	 textcolor(15);
         	 i=1;
          }
       	 else
          {
         	 ag.mostrar();
         	 s = 1;
          }
      }
      if ( i == 1 )
     	 {
        printf("\n\n NOME : ");
        textcolor(14); cprintf("%s", buff);
     	 }
       else if ( i == 2)
     	 {
        printf("\n\n ENDERECO : ");
        textcolor(14); cprintf("%s", buff);
     	 }
       else if ( i == 3 )
     	 {
        printf("\n\n TELEFONE : ");
        textcolor(14); cprintf("%s", buff);
     	 }
       else if ( i == 4 )
     	 {
        printf("\n\n E-MAIL : ");
        textcolor(14); cprintf("%s", buff);
        textcolor(15);
        printf("\n\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
     	 }
     i++;
     cad=1;
    }
  }
  getch();
  if ( s != 1 )
  {
  count++;
  if (cad == 1)
  {
  clrscr();
  textcolor(15);
  cprintf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
  textcolor(15);
  gotoxy(25,8);
  textcolor(14); cprintf("O %d§ cadastro ‚ o ultimo registro !", count);
  textcolor(15);
  gotoxy(23,10);
  cprintf("\n Digite ");
  textcolor(14); cprintf("5 ");
  textcolor(15);
  cprintf("para VOLTAR ou ");
  textcolor(14); cprintf("4 ");
  textcolor(15);
  cprintf("para SAIR : ");
  gotoxy(1,15);
  cprintf("-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  gotoxy(40,12);
  scanf("%d", &op);
    if ( op == 5 )
    {
   	 ag.mostrar();
    }
  }
  else
  {
  textcolor(14); cprintf("\n\n                                                     Desculpe, nenhum cadastro foi encontrado...");
  textcolor(15);
  printf("\n\n\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  printf("\n Digite ");
  textcolor(14); cprintf("5 ");
  textcolor(15);
  printf("para VOLTAR ou ");
  textcolor(14); cprintf("4 ");
  textcolor(15);
  printf("para SAIR : ");
  scanf("%d", &op);
    if ( op == 5 )
    {
   	 ag.mostrar();
    }
  }
  }
}
void agenda::mostrar()
{
  agenda ag; // CHAMANDO O CLASS...
  clrscr();
  printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
  textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
  textcolor(15);
  printf("\n\n   MENU :                                                                  ");
  printf("\n\n   1 - Inserir novo registo.                                                 ");
  printf("\n\n   2 - Consultar registro.                                                   ");
  printf("\n\n   3 - Apagar registros.                                                     ");
  printf("\n\n   4 - Sair.                                                                 ");
  printf("\n\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");  textcolor(14); cprintf("\n\n Digite sua escolha : ");
  textcolor(15);
  scanf("%d", &op);

     // CHAMANDO OS VOIDS PELOS IF'S...
      if ( op == 1)
       {
        ag.novoreg();
       }
      else if ( op == 2)
       {
         ag.consulta();
       }
      else if ( op == 3)
       {
         ag.apagar();
       }
  while ( op < 1 || op > 4 )
 	 {
     clrscr();
     printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
     textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
     textcolor(15);
     textcolor(4); cprintf("\n                                     !!! DESCULPE SUA ESCOLHA NAO EXISTE POR FAVOR SELECIONE OUTRA OPCAO !!!");
     textcolor(15);
     printf("\n\n   MENU :                                                                           ");
     printf("\n   1 - Inserir novo registo.                                                        ");
     printf("\n   2 - Consultar registro.                                                           ");
     printf("\n   3 - Apagar Registros.                                                          ");
     printf("\n   4 - Sair.                                                                        ");
     printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
     printf("\n\n Digite sua escolha : ");
     scanf("%d", &op);
     // CHAMANDO OS VOIDS PELOS IF'S...
      if ( op == 1)
       {
        ag.novoreg();
       }
      else if ( op == 2)
       {
         ag.consulta();
       }
      else if ( op == 3)
       {
         ag.apagar();
       }
 	 }
}
void agenda::apagar()
{
	agenda ag;
	ofstream fout;
	fout.open("c:\\Agenda.txt", ios::trunc);
	clrscr();
	printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
	textcolor(14); cprintf("\n                                   AGENDA G0 1.0");
	cprintf("\n\n                                                  Os registros foram apagados com sucesso !!! ");
	printf("\n\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
	printf("\n\n Digite ");
	textcolor(14); cprintf("5 ");
	textcolor(15);
	printf("para VOLTAR ou ");
	textcolor(14); cprintf("4 ");
	textcolor(15);
	printf("para SAIR : ");
	scanf("%d", &op);
  if ( op == 5 )
 	 {
    ag.mostrar();
 	 }
}
void main()
{
// DEFININDO CORES :
textmode(3);
textcolor(15);
textbackground(1);
// LIMPANDO A TELA :
clrscr();
// DEFININDO BD E CLASS :
agenda ag; // CHAMANDO O CLASS...
// COMECANDO A UTILIZAR OS VOID, PRIMEIRO MOSTRANDO A TELA PRINCIPAL :
ag.mostrar();
}

em turbo c !
Deveriam liberar imagens em php.

#3 linkzone

linkzone

    Turista

  • Usuários
  • 44 posts
  • Sexo:Não informado

Posted 17/10/2004, 15:20

Eu preciso q tenha esses campos
-nome completo da pessoa
-data de aniversário (dd/mm/aaaa)
-apelido
-telefone
-endereço
tem jeito?
OFF-LINE 4EVER!

#4 xg0rd0

xg0rd0

    Novato no fórum

  • Usuários
  • 21 posts
  • Sexo:Não informado

Posted 21/10/2004, 16:37

kra, eh o seguinte, eu coloquei essa ai pra fins didaticos, tente entender e modificar você mesmow !
qulaquer duvida é só falar !
Deveriam liberar imagens em php.

#5 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 13/09/2017, 19:29

Ativan En Ligne cialis Pediatric Dosage Of Keflex
Cialis 5 Ml Cialis 20mg Prices
Cialis Y Licor <a href=http://cialtobuy.com>cheap cialis</a> Priligy Viagra Juntos
Birth Control Pill And Cephalexin cialis Using Propecia Effects
Control Sex Pills Birth How To Buy Robax Platinum Without An Rx Viagra Super Aktiv
Propecia Calvicie <a href=http://cialtobuy.com>viagra cialis</a> Isotretinoin worldwide price amex accepted online
Propecia Efectos Caida Del Cabello online pharmacy Cataflam Zithromax Prednisone Canadian Pharmnacy Lioresal 10 Mg Cialis Generika Bestellen cialis price Propecia Germany РâСâвÐâРÑСâСâРÑСâР
Pills 365 cialis Sale Cialis Milano Amoxicillin For Children Trouble Keeping Down Bactroban Over The Counter buy cialis Para Que Sirve Cialis
Cialis Generika Berlin cialis Propecia Does It Work Women
Priligy Vs Tramadol
Amoxicillin For Pets <a href=http://cialtobuy.com>cialis buy online</a> Viagra Generic With Out Prescription
Cialis Canada Generic online pharmacy Buy Generic Plavix Canada
Online Pharmacy Baku Viagra Prix Pfizer Anyone Tried Priligy
Cialis 10 Mg O 20 Mg <a href=http://cialtobuy.com>viagra cialis</a> Viagra 28 Ans
Viagra Wirkt Nicht Forum cialis Primatene Mist In Canada
Pimple Ciprofloxacin Online Without A Prescia Pharmaceutical Cephalexin
How Many Mg Of Viagra Should I Take <a href=http://cialtobuy.com>cheap cialis</a> Using Cephalexin On Pregnant Dogs




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq