示例#1
0
void inicio(FILE* arq, char** mat, char ch, char* s, char* aux){
	int i=0, j=0, cont=0;
	printf ("Exibindo todos os candidatos:\n");
	while( (ch=fgetc(arq))!= EOF){
		*(s+i) = ch; //passa os nomes para string
		*(aux+j) = ch; //salva linhas
		if (ch == '\n'){
		*(aux+j+1) = '\0';
			if (aux[0] == 'R'){
				cont++;
			}
			j=0;
		} else {
			j++;
		}
		i++;
		putchar(ch);
	}
	*(s+i) = '\0'; //evitar problema com o ultmo nome
	*(aux+j+1) = '\0';
	
	if (aux[0] == 'R')
		cont++;
		
	mat = aloca(mat, cont+1); //aloca a matriz
	
	i=0;
	j=0;
	cont=0;
	
	while (*(s+i) == '\0'){
		*(aux+j) = *(s+i);
		
		if (*(s+i) = '\n'){
			*(aux+j+1) = '\0';
			if (aux[0] == 'R'){
				strcpy (mat[cont], aux); //passa os nomes na string pra matriz
				cont++;
			}
			j=0;
		} else {
			j++;
		}
		i++;
	}
	
	*(aux+j+1) = '\0';
	
	if (aux[0] == 'R'){
		strcpy (mat[cont], aux);//salva os clientes com R
		cont++;
	}
	
	qsort (mat, (size_t)cont, sizeof(char*), comp);
	
	fim(mat, cont);
}
示例#2
0
int main(void)
{                            /*Inicializa a matriz*/
   int i, j, z=0;
   char m[3][3];
   for(i=0; i<3; i++)
      for(j=0; j<3; j++)
         m[i][j]=' ';
   imprimir(m);
     printf("\n\t\t Bem vindo ao Jogo da Velha\n");
   do
  {
  jogador1(m);   /*O jogador 1 joga*/
  imprimir(m);    /*Imprime na tela a jogada*/
  fim(m);         /*Verifica a jogada*/
   if(fim(m))     /*Condição que verifica se ele venceu*/
   {
     printf("\n\t\t Jogador 1 Venceu\n");
     return 0;
   }
   z++;
   if(z==9)        /*Quando o numero de jogadas for igual a 9 para*/
   {
    break;
   }
   jogador2(m);   /*O jogador 2 joga*/
   imprimir(m);    /*Imprime na tela a jogada*/
   fim(m);         /*Verifica a jogada*/
    if(fim(m))     /*Condição que verifica se ele venceu*/
    {
      printf("\n\t\t Jogador 2 Venceu\n");
      return 0;
    }
   z++;
   }
   while(z!=9);    /*Jogar ate que o numero de jogadas seja igual a 9*/
   printf("\n Jogo Empatado");
   return 0;   
}
示例#3
0
void le()
{
  char nome[50]={"\0"};
  while(nome[0]!= 'F')
  {
     printf("Digite o nome do soldado: \n");
     printf("Para finalizar exercito, digite 'F' : \n");
     gets(nome);
     if(nome[0]!= 'F')
     {
        insere(&lista,nome);
        nome[0]='\0';
     }
     else
     {
        fim(&lista);
        printf("LISTA DE SOLDADOS FINALIZADA!\n\n\n");
     }
  } 
}
示例#4
0
int main(){
f = fopen("bd.bin", "a+b");
    char c;
    printf("** BANCO INTERNACIONAL **\n\n");
    printf("(1) JA SOU CLIENTE\n");
    printf("(2) NOVO CLIENTE\n\n");
    printf("DIGITE SUA OPCAO: ");
    scanf(" %c", &c);
    if(c == '2'){
        novocadastro();}
    if(c == '1') {
                fread(&cad.n, sizeof(char), 50, f);
                fread(&cad.u, sizeof(char), 50, f);
                fread(&cad.senha, sizeof(char), 11, f);
                fread(&cad.cpf, sizeof(char), 12, f);
                fread(&cad.data, sizeof(char), 11, f);
                fread(&cad.e1, sizeof(char), 20, f);
                fread(&cad.e2, sizeof(char), 20, f);
                fread(&cad.num, sizeof(char), 7, f);
                fread(&cad.comp, sizeof(char), 7, f);
                fread(&cad.bar, sizeof(char), 30, f);
                fread(&cad.cep, sizeof(char), 10, f);
                fread(&cad.c, sizeof(char), 20, f);
                fread(&cad.tel, sizeof(char), 12, f);
                fread(&cad.cel, sizeof(char), 12, f);
                fread(&cad.s, sizeof(int), 1, f);
                fread(&cad.cred, sizeof(int), 1, f);
                fread(&cad.deposito, sizeof(int), 1, f);
                fread(&cad.saque, sizeof(int), 1, f);
                fread(&cad.saqcred, sizeof(int), 1, f);
            conta();}
    if( c != '1' && c != '2'){
        printf("\n\n** AGRADECEMOS A SUA PREFERENCIA **.\n");
            fim();}
    return 0;
}
示例#5
0
int verificaXML(pilhas p)
{
	lista l; //LISTA QUE GUARDARA OS ITENS.EX: <nome> </nome>  (NELA IREI COMPARAR AS STRINGS)
	l = cria_item();
	tipo_nod *a; //UTILIZAREI PARA PERCORRER TODA A PILHA QUE CONTEM TODO O TEXTO XML
	a = p->inicio;
	while (a != NULL)
	{
		if ((a->elemento == '<' && a->prox->elemento == '\0')||(a->elemento == '<' && a->prox->elemento == '\n')) //ERROS PRIMARIOS
			return 0;
		if (a->elemento == '<' && a->prox->elemento == '?' && a->prox->prox != NULL) //SE FOR A PRIMEIRA LINHA
		{
			a = a->prox->prox;
			while (a->elemento != '?')
			{
				if (a->elemento == '\0' || a->elemento == '\n' || a->prox == NULL)
					return 0;
				a = a->prox;
			}
			if (a->elemento == '?' && a->prox->elemento != '>')
			{
				return 0;
       		}
		}
		if (a->elemento == '<' && a->prox->elemento == '!' && a->prox->prox != NULL)  //SE FOR UM COMENTARIO
        {
			a = a->prox->prox;
			if (a->elemento == '>')
				return 0;
			while (a->elemento != '>')
			{
				if (a->elemento == '\0' || a->elemento == '\n' || a->prox == NULL)
					return 0;
				a = a->prox;
			}
		}
		if (a->elemento == '<' && a->prox->elemento != ' '  && a->prox->elemento != '?' && a->prox->elemento != '/' && a->prox != NULL)  //VERIFICA LINHA POR LINHA
		{
			adicionar_item(l,1);  //CRIA UM ITEM VAZIO E COLOCA NA PILHA
			a = a->prox;
			if (a->elemento == '>')
				return 0;
			while (a->elemento != '>')
			{
				if (a->elemento == '\0' || a->elemento == '\n' || a == NULL)
					return 0;
				colocar_item(l,a->elemento,1);  //COLOCA LETRA POR LETRA NO ITEM CRIADO ANTERIORMENTE (CASO SEJA <> COLOCA NA PRIMEIRA PILHA SENAO </> COLOCA NA SEGUNDA PILHA
				a = a->prox;
			}
			if (a->elemento == '<' && a->prox->elemento != ' ' && a->prox->prox != NULL)
			{
				adicionar_item(l,1);  //SE CASO FOR <> E <> ELE COLOCA NOVAMENTE NA PILHA
				a = a->prox->prox;
				if (a->elemento == '>')
					return 0;
				while (a->elemento != '>')
				{
					if (a->elemento == '\0' || a->elemento == '\n' || a == NULL)
						return 0;
					colocar_item(l,a->elemento,1);  //COLOCA LETRA POR LETRA
					a = a->prox;
				}
			}
		}
		if (a->elemento == '<' && a->prox->elemento == '/' && a->prox->prox != NULL && a->prox->elemento != ' ') //CASO TENHA ENCONTRADO UM </>
		{
			adicionar_item(l,2); //CRIA UM ITEM EM UMA PILHA SEPARADA DA PRIMEIRA
			a = a->prox->prox;
			if (a->elemento == '>')
				return 0;
			while (a->elemento != '>')
			{
				if (a->elemento == '\0' || a->elemento == '\n' || a == NULL)
					return 0;
				colocar_item(l,a->elemento,2); //COLOCA LETRA POR LETRA
				a = a->prox;
				if (a->elemento == '>')
				{
					if (strcmp(fim(l,1),fim(l,2)) != 0) //COMPARA A ULTIMA PALAVRA DA PRIMEIRA PILHA COM A ULTIMA PALAVRA DA SEGUNDA PILHA
						return 0;
					termina_item(l); //SE VERDADE, ELE RETIRA AS PALAVRAS E CONTINUA A VERIFICACAO
				}
			}
		}
		if ((a->prox == NULL && l->tamanhoTotalFim > l->tamanhoTotalInicio) || (a->prox == NULL && l->tamanhoTotalFim < l->tamanhoTotalInicio)) // CASO TENHA PALAVRAS A MAIS EM ALGUMA PILHA = ERRO, POIS SE EXISTE UM <> DEVA AHAVER UM </>
		{
			return 0;
		}
		a = a->prox;
	}
	return 1;
}
示例#6
0
void UcClassCanvas::draw(QPainter & p) {
  if (! visible()) return;
  p.setRenderHint(QPainter::Antialiasing, true);
  QRect r = rect();
  QFontMetrics fm(the_canvas()->get_font(UmlNormalFont));
  QFontMetrics fim(the_canvas()->get_font(UmlNormalItalicFont));
  QColor bckgrnd = p.backgroundColor();
  double zoom = the_canvas()->zoom();
  FILE * fp = svg();

  if (fp != 0)
    fputs("<g>\n", fp);

  p.setBackgroundMode((used_color == UmlTransparent) ? ::Qt::TransparentMode : ::Qt::OpaqueMode);

  QColor co = color(used_color);
  
  if (used_view_mode == asClass) {
    if (used_color != UmlTransparent) {
      const int shadow = the_canvas()->shadow();

      if (shadow != 0) {
	r.setRight(r.right() - shadow);
	r.setBottom(r.bottom() - shadow);
	
	p.fillRect (r.right(), r.top() + shadow,
		    shadow, r.height() - 1,
		    ::Qt::darkGray);
	p.fillRect (r.left() + shadow, r.bottom(),
		    r.width() - 1, shadow,
		    ::Qt::darkGray);

	if (fp != 0) {
	  fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\""
		  " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		  QColor(::Qt::darkGray).rgb()&0xffffff,
		  r.right(), r.top() + shadow, shadow - 1, r.height() - 1 - 1);

	  fprintf(fp, "\t<rect fill=\"#%06x\" stroke=\"none\" stroke-opacity=\"1\""
		  " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		  QColor(::Qt::darkGray).rgb()&0xffffff,
		  r.left() + shadow, r.bottom(), r.width() - 1 - 1, shadow - 1);
	}
      }
    }
    
    p.setBackgroundColor(co);
  
    if (used_color != UmlTransparent) {
      p.fillRect(r, co);

      if (fp != 0)
	fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
		" x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		svg_color(used_color), 
		r.x(), r.y(), r.width() - 1, r.height() - 1);
    }
    else if (fp != 0)
      fprintf(fp, "\t<rect fill=\"none\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
	      " x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
	      r.x(), r.y(), r.width() - 1, r.height() - 1);

    p.drawRect(r);
  }
  
  const ClassData * data = ((ClassData *) browser_node->get_data());
  const int two = (int) (2 * zoom);
  int he = fm.height() + two;
  
  if (data->get_n_formalparams() != 0)
    r.setTop(r.top() + fm.height());
  
  switch (used_view_mode) {
  case asInterface:
    draw_interface_icon(p, r, used_color, zoom);
    r.setTop(r.top() + (int) (INTERFACE_SIZE * zoom) + two);
    break;
  case asControl:
    draw_control_icon(p, r, used_color, zoom);
    r.setTop(r.top() + (int) (CONTROL_HEIGHT * zoom) + two);
    break;
  case asBoundary:
    draw_boundary_icon(p, r, used_color, zoom);
    r.setTop(r.top() + (int) (BOUNDARY_HEIGHT * zoom) + two);
    break;
  case asEntity:
    draw_entity_icon(p, r, used_color, zoom);
    r.setTop(r.top() + (int) (ENTITY_SIZE * zoom) + two);
    break;
  case asActor:
    {
      QRect ra = r;
      
      ra.setHeight((int) (ACTOR_SIZE * zoom));
      ra.setLeft(ra.left() + 
		 (int) ((ra.width() - ACTOR_SIZE * zoom)/2));
      ra.setWidth(ra.height());
      draw_actor(&p, ra);
    }
    r.setTop(r.top() + (int) (ACTOR_SIZE * zoom) + two);
    break;
  case Natural:
    {
      const QPixmap * px = 
	ProfiledStereotypes::diagramPixmap(data->get_stereotype(), zoom);
      int lft = (px->width() < width()) ? r.x() + (width() - px->width())/2 : r.x();

      p.drawPixmap(lft, r.y(), *px);
      if (fp != 0)
	// pixmap not really exported in SVG
	fprintf(fp, "\t<rect fill=\"%s\" stroke=\"black\" stroke-width=\"1\" stroke-opacity=\"1\""
		" x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" />\n",
		svg_color(UmlBlack), lft, r.y(), px->width() - 1, px->height() - 1);

      r.setTop(r.top() + px->height());
    }
    break;
  default:	// class
    r.setTop(r.top() + two);
    if (data->get_stereotype()[0]) {
      p.setFont(the_canvas()->get_font(UmlNormalFont));
      p.drawText(r, ::Qt::AlignHCenter + ::Qt::AlignTop, 
		 QString("<<") + toUnicode(data->get_short_stereotype()) + ">>");
      if (fp != 0)
	draw_text(r, ::Qt::AlignHCenter + ::Qt::AlignTop, 
		  QString("<<") + toUnicode(data->get_short_stereotype()) + ">>",
		  p.font(), fp);
      r.setTop(r.top() + he + two);
    }
  }
  
  p.setBackgroundMode(::Qt::TransparentMode);
  p.setFont((data->get_is_abstract())
	    ? the_canvas()->get_font(UmlNormalItalicFont)
	    : the_canvas()->get_font(UmlNormalFont));
  p.drawText(r, ::Qt::AlignHCenter + ::Qt::AlignTop, full_name);
  if (fp != 0)
    draw_text(r, ::Qt::AlignHCenter + ::Qt::AlignTop, full_name, p.font(), fp);

  p.setFont(the_canvas()->get_font(UmlNormalFont));
  
  if (used_view_mode == asClass) {
    r.setTop(r.top() + he);
    p.drawLine(r.topLeft(), r.topRight());
    
    if (fp != 0)
      fprintf(fp, "\t<line stroke=\"black\" stroke-opacity=\"1\""
	      " x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n",
	      r.left(), r.top(), r.right(), r.top());
    
    r.setTop(r.top() + (int) (8 * zoom));
    p.drawLine(r.topLeft(), r.topRight());
    
    if (fp != 0)
      fprintf(fp, "\t<line stroke=\"black\" stroke-opacity=\"1\""
	      " x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />\n",
	      r.left(), r.top(), r.right(), r.top());
  }
  
  if (fp != 0)
    fputs("</g>\n", fp);
    
  p.setBackgroundColor(bckgrnd);
  
  if (selected())
    show_mark(p, rect());
}
示例#7
0
void UcClassCanvas::compute_size() {
  used_settings = settings;
  ((BrowserUseCaseDiagram *) the_canvas()->browser_diagram())
    ->get_simpleclassdiagramsettings(used_settings);

  full_name = browser_node->get_name();
  
  const MyStr & (PackageData::*f)() const = 0;
  const char * sep = 0;	// to avoid warning
  
  switch (used_settings.show_context_mode) {
  case umlContext:
    full_name = browser_node->full_name();
    break;
  case namespaceContext:
    f = &PackageData::get_cpp_namespace;
    sep = "::";
    break;
  case javaPackageContext:
    f = &PackageData::get_java_package;
    sep = ".";
    break;
  case pythonPackageContext:
    f = &PackageData::get_python_package;
    sep = ".";
    break;
  case moduleContext:
    f = &PackageData::get_idl_module;
    sep = "::";
    break;
  default:
    break;
  }
  
  if (f != 0) {
    BrowserClass * cl = (BrowserClass *) browser_node;
    
    while (cl->nestedp())
      cl = (BrowserClass *) cl->parent();
    
    if (((BrowserNode *) cl->parent())->get_type() == UmlClassView) {
      // not under a use case
      BrowserArtifact * cp = cl->get_associated_artifact();
      
      QString context =
	(((PackageData *)
	  ((BrowserNode *)
	   (((cp == 0) ? (BrowserNode *) cl : (BrowserNode *) cp)
	    ->parent()->parent()))->get_data())->*f)();
      
      if (!context.isEmpty())
	full_name = context + sep + full_name;
    }
  }
  
  QFontMetrics fm(the_canvas()->get_font(UmlNormalFont));
  QFontMetrics fim(the_canvas()->get_font(UmlNormalItalicFont));
  const ClassData * data = ((ClassData *) browser_node->get_data());
  int wi =
    (data->get_is_abstract()) ? fim.width(full_name) : fm.width(full_name);
  double zoom = the_canvas()->zoom();
  const QPixmap * px = 0;

  if (used_settings.class_drawing_mode == Natural) {
    if ((px = ProfiledStereotypes::diagramPixmap(data->get_stereotype(), zoom)) != 0)
      used_view_mode = Natural;
    else {
      const char * st = data->get_short_stereotype();
      
      if (!strcmp(st, "control"))
	used_view_mode = asControl;
      else if (!strcmp(st, "entity"))
	used_view_mode = asEntity;
      else if (!strcmp(st, "boundary"))
	used_view_mode = asBoundary;
      else if (!strcmp(st, "actor"))
	used_view_mode = asActor;
      else if (!strcmp(st, "interface"))
	used_view_mode = asInterface;
      else
	used_view_mode = asClass;
    }
  }
  else
    used_view_mode = used_settings.class_drawing_mode;

  const int eight = (int) (8 * zoom);

  int he = fm.height() + eight;
  
  bool tmpl = data->get_n_formalparams() != 0;
  
  if (tmpl)
    he += fm.height();
  
  if (used_view_mode == asClass) {
    he += (int) (12 * zoom);
    
    if (data->get_stereotype()[0]) {
      int stw = fm.width(QString("<<") + toUnicode(data->get_short_stereotype()) + ">>");
      
      if (wi < stw)
	wi = stw;
      
      he += fm.height() + (int) (4 * zoom);
    }
  }
  
  wi += eight;
  
  int min_w;
  
  switch (used_view_mode) {
  case asInterface:
    min_w = (int) (INTERFACE_SIZE * zoom);
    he += min_w;
    break;
  case asControl:
    min_w = (int) (CONTROL_WIDTH * zoom);
    he += (int) (CONTROL_HEIGHT * zoom);
    break;
  case asBoundary:
    min_w = (int) (BOUNDARY_WIDTH * zoom);
    he += (int) (BOUNDARY_HEIGHT * zoom);
    break;
  case asEntity:
    min_w = (int) (ENTITY_SIZE * zoom);
    he += min_w;
    break;
  case asActor:
    min_w = (int) (ACTOR_SIZE * zoom);
    he += (int) (ACTOR_SIZE * zoom);
    break;
  case Natural:
    // pixmap
    min_w = px->width();
    he += px->height();
    break;
  default:	// class
    min_w = (int) (CLASS_CANVAS_MIN_SIZE * zoom);
    break;
  }
  
  if (wi < min_w)
    wi = min_w;
  
  used_color = (itscolor == UmlDefaultColor)
    ? the_canvas()->browser_diagram()->get_color(UmlClass)
    : itscolor;
  
  if ((used_view_mode == asClass) && (used_color != UmlTransparent)) {
    const int shadow = the_canvas()->shadow();
    
    wi += shadow;
    he += shadow;
  }
  
  // force odd width and height for line alignment
  DiagramCanvas::resize(wi | 1, he | 1);
    
  if (tmpl) {
    if (templ == 0) {
      templ = new TemplateCanvas(this);
      templ->show();
    }
    else
      templ->update();
  }
  else if (templ != 0) {
    templ->delete_it();
    templ = 0;
  }
}
int reduced_charset(struct zint_symbol *symbol, unsigned char *source, int length)
{
	/* These are the "norm" standards which only support Latin-1 at most */
	int error_number = 0;
	
#ifndef _MSC_VER
	unsigned char preprocessed[length + 1];
#else
        unsigned char* preprocessed = (unsigned char*)_alloca(length + 1);
#endif
	
	if(symbol->symbology == BARCODE_CODE16K) {
		symbol->whitespace_width = 16;
		symbol->border_width = 2;
		symbol->output_options = BARCODE_BIND;
	}
	
	if(symbol->symbology == BARCODE_ITF14) {
		symbol->whitespace_width = 20;
		symbol->border_width = 8;
		symbol->output_options = BARCODE_BOX;
	}
	
	switch(symbol->input_mode) {
		case DATA_MODE:
		case GS1_MODE:
			memcpy(preprocessed, source, length);
			preprocessed[length] = '\0';
			break;
		case UNICODE_MODE:
			error_number = latin1_process(symbol, source, preprocessed, &length);
			if(error_number != 0) { return error_number; }
			break;
	}

	switch(symbol->symbology) {
		case BARCODE_C25MATRIX: error_number = matrix_two_of_five(symbol, preprocessed, length); break;
		case BARCODE_C25IND: error_number = industrial_two_of_five(symbol, preprocessed, length); break;
		case BARCODE_C25INTER: error_number = interleaved_two_of_five(symbol, preprocessed, length); break;
		case BARCODE_C25IATA: error_number = iata_two_of_five(symbol, preprocessed, length); break;
		case BARCODE_C25LOGIC: error_number = logic_two_of_five(symbol, preprocessed, length); break;
		case BARCODE_DPLEIT: error_number = dpleit(symbol, preprocessed, length); break;
		case BARCODE_DPIDENT: error_number = dpident(symbol, preprocessed, length); break;
		case BARCODE_UPCA: error_number = eanx(symbol, preprocessed, length); break;
		case BARCODE_UPCE: error_number = eanx(symbol, preprocessed, length); break;
		case BARCODE_EANX: error_number = eanx(symbol, preprocessed, length); break;
		case BARCODE_EAN128: error_number = ean_128(symbol, preprocessed, length); break;
		case BARCODE_CODE39: error_number = c39(symbol, preprocessed, length); break;
		case BARCODE_PZN: error_number = pharmazentral(symbol, preprocessed, length); break;
		case BARCODE_EXCODE39: error_number = ec39(symbol, preprocessed, length); break;
		case BARCODE_CODABAR: error_number = codabar(symbol, preprocessed, length); break;
		case BARCODE_CODE93: error_number = c93(symbol, preprocessed, length); break;
		case BARCODE_LOGMARS: error_number = c39(symbol, preprocessed, length); break;
		case BARCODE_CODE128: error_number = code_128(symbol, preprocessed, length); break;
		case BARCODE_CODE128B: error_number = code_128(symbol, preprocessed, length); break;
		case BARCODE_NVE18: error_number = nve_18(symbol, preprocessed, length); break;
		case BARCODE_CODE11: error_number = code_11(symbol, preprocessed, length); break;
		case BARCODE_MSI_PLESSEY: error_number = msi_handle(symbol, preprocessed, length); break;
		case BARCODE_TELEPEN: error_number = telepen(symbol, preprocessed, length); break;
		case BARCODE_TELEPEN_NUM: error_number = telepen_num(symbol, preprocessed, length); break;
		case BARCODE_PHARMA: error_number = pharma_one(symbol, preprocessed, length); break;
		case BARCODE_PLESSEY: error_number = plessey(symbol, preprocessed, length); break;
		case BARCODE_ITF14: error_number = itf14(symbol, preprocessed, length); break;
		case BARCODE_FLAT: error_number = flattermarken(symbol, preprocessed, length); break;
		case BARCODE_FIM: error_number = fim(symbol, preprocessed, length); break;
		case BARCODE_POSTNET: error_number = post_plot(symbol, preprocessed, length); break;
		case BARCODE_PLANET: error_number = planet_plot(symbol, preprocessed, length); break;
		case BARCODE_RM4SCC: error_number = royal_plot(symbol, preprocessed, length); break;
		case BARCODE_AUSPOST: error_number = australia_post(symbol, preprocessed, length); break;
		case BARCODE_AUSREPLY: error_number = australia_post(symbol, preprocessed, length); break;
		case BARCODE_AUSROUTE: error_number = australia_post(symbol, preprocessed, length); break;
		case BARCODE_AUSREDIRECT: error_number = australia_post(symbol, preprocessed, length); break;
		case BARCODE_CODE16K: error_number = code16k(symbol, preprocessed, length); break;
		case BARCODE_PHARMA_TWO: error_number = pharma_two(symbol, preprocessed, length); break;
		case BARCODE_ONECODE: error_number = imail(symbol, preprocessed, length); break;
		case BARCODE_ISBNX: error_number = eanx(symbol, preprocessed, length); break;
		case BARCODE_RSS14: error_number = rss14(symbol, preprocessed, length); break;
		case BARCODE_RSS14STACK: error_number = rss14(symbol, preprocessed, length); break;
		case BARCODE_RSS14STACK_OMNI: error_number = rss14(symbol, preprocessed, length); break;
		case BARCODE_RSS_LTD: error_number = rsslimited(symbol, preprocessed, length); break;
		case BARCODE_RSS_EXP: error_number = rssexpanded(symbol, preprocessed, length); break;
		case BARCODE_RSS_EXPSTACK: error_number = rssexpanded(symbol, preprocessed, length); break;
		case BARCODE_EANX_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_EAN128_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_RSS14_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_RSS_LTD_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_RSS_EXP_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_UPCA_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_UPCE_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_RSS14STACK_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_RSS14_OMNI_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_RSS_EXPSTACK_CC: error_number = composite(symbol, preprocessed, length); break;
		case BARCODE_KIX: error_number = kix_code(symbol, preprocessed, length); break;
		case BARCODE_CODE32: error_number = code32(symbol, preprocessed, length); break;
		case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, length); break;
		case BARCODE_EAN14: error_number = ean_14(symbol, preprocessed, length); break;
		case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, length); break;
		case BARCODE_KOREAPOST: error_number = korea_post(symbol, preprocessed, length); break;
		case BARCODE_HIBC_128: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_HIBC_39: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_HIBC_DM: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_HIBC_QR: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_HIBC_PDF: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length); break;
		case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length); break;
		case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length); break;
		case BARCODE_CHANNEL: error_number = channel_code(symbol, preprocessed, length); break;
		case BARCODE_CODEONE: error_number = code_one(symbol, preprocessed, length); break;
		case BARCODE_DATAMATRIX: error_number = dmatrix(symbol, preprocessed, length); break;
		case BARCODE_PDF417: error_number = pdf417enc(symbol, preprocessed, length); break;
		case BARCODE_PDF417TRUNC: error_number = pdf417enc(symbol, preprocessed, length); break;
		case BARCODE_MICROPDF417: error_number = micro_pdf417(symbol, preprocessed, length); break;
		case BARCODE_MAXICODE: error_number = maxicode(symbol, preprocessed, length); break;
		case BARCODE_AZTEC: error_number = aztec(symbol, preprocessed, length); break;
	}
	
	return error_number;
}
示例#9
0
void menu(){
        char k;
        printf("\n** ACESSO A CONTA **");
        printf("\n\n(1) SALDO ATUAL \n(2) CREDITO ATUAL \n(3) DEPOSITO RECENTE \n(4) SAQUE RECENTE \n(5) SAQUE DE CREDITO RECENTE \n(6) EXTRATO \n(7) EFETUAR MOVIMENTACAO \n(8) ENCERRAR");
        printf("\n\nDIGITE SUA OPCAO: ");
        scanf(" %c", &k);
        switch(k){
            case '1':
                printf("\nSALDO ATUAL: R$ %i,00\n\n", cad.s);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &k);
                 if( k == '1') menu();
                 else { fim(); }
            case '2':
                printf("\nCREDITO ATUAL: R$ %i,00\n", cad.cred);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &k);
                 if( k == '1') menu();
                 else { fim(); }
            case '3':
                printf("\nDEPOSITO RECENTE: R$ %i,00\n", cad.deposito);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &k);
                 if( k == '1') menu();
                 else { fim(); }
            case '4':
                printf("\nSAQUE RECENTE: R$ %i,00\n", cad.saque);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &k);
                 if( k == '1')  menu();
                 else { fim(); }
            case '5':
                printf("\nSAQUE DE CREDITO RECENTE: R$ %i,00\n", cad.saqcred);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &k);
                 if( k == '1')  menu();
                 else { fim(); }
            case '6':
                printf("\nSALDO ATUAL: R$ %i,00\n", cad.s);
                printf("CREDITO ATUAL: R$ %i,00\n", cad.cred);
                printf("DEPOSITO RECENTE: R$ %i,00\n", cad.deposito);
                printf("SAQUE RECENTE: R$ %i,00\n", cad.saque);
                printf("SAQUE CREDITO RECENTE: R$ %i,00\n", cad.saqcred);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("DIGITE SUA OPCAO: ");
                scanf(" %c", &k);
                 if( k == '1') menu();
                 else { fim(); }
            case '7':
                movimentacao();
                break;
            case '8':
            fim();
            default:
        printf("\nESCOLHA UMA OPCAO VALIDA\n");
            menu();}
}
示例#10
0
int novocadastro(void){
f = fopen("bd.bin", "a+b");
    char c;
    if(!f){
     printf("Erro na abertura do arquivo.");
         exit(1);}
    printf("\n** CADASTRO DE NOVO USUARIO **\n");
    printf("Obs.: Digite 'x' nos locais cujo o preenchimento nao seja preciso.\n");
    printf("Ex.: Complemento: x\n\n");
    printf("NOME E ULTIMO SOBRENOME: ");
        scanf(" %s %s", cad.n, cad.u);
            fwrite(&cad.n, sizeof(char), 50, f);
            fwrite(&cad.u, sizeof(char), 50, f);
    printf("SENHA (Max 10 caracteres): ");
        scanf(" %s", cad.senha);
            fwrite(&cad.senha, sizeof(char), 11, f);
    printf("CPF (So numeros): ");
        scanf("%s", cad.cpf);
            fwrite(&cad.cpf, sizeof(char), 12, f);
    printf("DATA DE NASCIMENTO (Ex: 11-02-1954): ");
        scanf(" %s", cad.data);
            fwrite(&cad.data, sizeof(char), 11, f);
    printf("ENDERECO: Rua/Av ");
        scanf(" %s %s", cad.e1, cad.e2);
            fwrite(&cad.e1, sizeof(char), 20, f);
            fwrite(&cad.e2, sizeof(char), 20, f);
    printf("NUMERO: ");
       scanf(" %s", cad.num);
            fwrite(&cad.num, sizeof(char), 7, f);
    printf("COMPLEMENTO: ");
       scanf(" %s", cad.comp);
            fwrite(&cad.comp, sizeof(char), 7, f);
    printf("BAIRRO: ");
       scanf(" %s", cad.bar);
          fwrite(&cad.bar, sizeof(char), 30, f);
     printf("CEP (Ex.: 60000-000): ");
        scanf(" %s", cad.cep);
            fwrite(&cad.cep, sizeof(char), 10, f);
    printf("CIDADE: ");
        scanf(" %s", cad.c);
           fwrite(&cad.c, sizeof(char), 20, f);
   printf("TEL: ");
        scanf(" %s", cad.tel);
            fwrite(&cad.tel, sizeof(char), 12, f);
   printf("CEL: ");
        scanf(" %s", cad.cel);
            fwrite(&cad.cel, sizeof(char), 12, f);
    fwrite(&cad.s, sizeof(int), 1, f);
    fwrite(&cad.cred, sizeof(int), 1, f);
    fwrite(&cad.deposito, sizeof(int), 1, f);
    fwrite(&cad.saque, sizeof(int), 1, f);
   printf("\n** CONTA CRIADA COM SUCESSO! **\n\n");
   fclose(f);
line:   printf("(1) PARA ACESSAR SUA CONTA\n");
   printf("(2) PARA ALTERAR DADOS CADASTRAIS\n");
   printf("(3) PARA ENCERRAR\n\n");
   printf("DIGITE SUA OPCAO: ");
   scanf(" %c", &c);
    switch(c){
    case '1':
        conta();
        break;
    case '2':
        alterar();
        break;
    case '3':
        printf("\n** AGRADECEMOS A SUA PREFERENCIA. **\n");
            fim();
    default:
        printf("\nESCOLHA UMA OPCAO VALIDA\n");
            goto line;}
}
示例#11
0
void alterar(){
    char g;
    printf("\n** ALTERACAO DE DADOS CADASTRAIS **\n\n");
    printf("(1) NOME \n(2) SOBRENOME \n(3) SENHA \n(4) CPF \n(5) DATA DE NASCIMENTO");
    printf("\n(6) ENDERECO \n(7) CIDADE \n(8) TELEFONES\n");
    printf("\nDIGITE SUA OPCAO: ");
    scanf(" %c", &g);
    switch(g){
        case '1':
            printf("NOVO NOME: ");
            scanf(" %s", cad.n);
            fwrite(&cad.n, sizeof(char), 50, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        case '2':
            printf("NOVO SOBRENOME: ");
            scanf(" %s", cad.u);
            fwrite(&cad.u, sizeof(char), 50, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        case '3':
            char senh[11];
            printf("SENHA ANTIGA: ");
            scanf(" %s", senh);
        if(strcmp(senh, cad.senha)){
            printf("SENHA NAO COMPATIVEL.\nACESSO NAO PERMITIDO.\n\n");
            alterar();
        }
        else{
            printf("NOVA SENHA: ");
            scanf(" %s", cad.senha);
            fwrite(&cad.senha, sizeof(char), 11, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); } } ;
        case '4':
            printf("NOVO CPF: ");
            scanf(" %s", cad.cpf);
            fwrite(&cad.cpf, sizeof(char), 12, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        case '5':
            printf("NOVA DATA DE NASCIMENTO: ");
            scanf(" %s", cad.data);
            fwrite(&cad.data, sizeof(char), 11, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        case '6':
            printf("NOVO ENDEREÇO: Rua/Av ");
            scanf(" %s %s", cad.e1, cad.e2);
                fwrite(&cad.e1, sizeof(char), 20, f);
                fwrite(&cad.e2, sizeof(char), 20, f);
            printf("NUMERO: ");
            scanf(" %s", cad.num);
                fwrite(&cad.num, sizeof(char), 7, f);
            printf("COMPLEMENTO: ");
            scanf(" %s", cad.comp);
                fwrite(&cad.comp, sizeof(char), 7, f);
            printf("BAIRRO: ");
            scanf(" %s", cad.bar);
                fwrite(&cad.bar, sizeof(char), 30, f);
            printf("CEP (Ex.: 60000-000): ");
                scanf(" %s", cad.cep);
                fwrite(&cad.cep, sizeof(char), 10, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        case '7':
            printf("NOVA CIDADE: ");
            scanf(" %s", cad.c);
            fwrite(&cad.c, sizeof(char), 20, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        case '8':
            printf("NOVO TELEFONE: ");
            scanf(" %s", cad.tel);
            fwrite(&cad.senha, sizeof(char), 11, f);
            printf("NOVO CELULAR: ");
            scanf(" %s", cad.cel);
            fwrite(&cad.cel, sizeof(char), 12, f);
            printf("\n(1) MENU ANTERIOR   (2) ACESSAR CONTA   (3) ENCERRAR\n\n ");
                printf("\nDIGITE SUA OPCAO: ");
                scanf(" %c", &g);
                 if( g == '1') alterar();
                 if( g == '2') conta();
                 if( g != '1' && g != '2') { fim(); }
        }
}
示例#12
0
void movimentacao(){
    char m;
    int cash;
    printf("\n** EFETUAR MOVIMENTACAO **");
    printf("\n\n(1) SAQUE \n(2) DEPOSITO \n(3) CREDITO \n(4) EXTRATO \n(5) MENU ANTERIOR\n");
    printf("\nDIGITE SUA OPCAO: ");
    scanf(" %c", &m);
    switch(m){
        case '1':
                printf("\nDIGITE O VALOR DO SAQUE: ");
                scanf(" %i", &cash);
                if(cash > cad.s) { printf("\nSALDO INSUFICIENTE\n\n"); }
                else {
                    cad.s -= cash;
                    cad.saque = cash;
                fwrite(&cad.s, sizeof(int), 1, f);
                fwrite(&cad.saque, sizeof(int), 1, f);
                printf("\n** SAQUE EFETUADO COM SUCESSO **\n"); }
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("DIGITE SUA OPCAO: ");
                scanf(" %c", &m);
                 if( m == '1') movimentacao();
                 else { fim(); }
        case '2':
                printf("\nDIGITE O VALOR DO DEPOSITO: ");
                scanf(" %i", &cash);
                cad.s += cash;
                cad.deposito = cash;
                cad.cred += (cad.s / 4 );
                fwrite(&cad.s, sizeof(int), 1, f);
                fwrite(&cad.cred, sizeof(int), 1, f);
                fwrite(&cad.deposito, sizeof(int), 1, f);
                printf("\n** DEPOSITO EFETUADO COM SUCESSO **\n");
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("DIGITE SUA OPCAO: ");
                scanf(" %c", &m);
                 if( m == '1') movimentacao();
                 else { fim(); }
        case '3':
                printf("\nDIGITE O VALOR DO SAQUE DO CREDITO: ");
                scanf(" %i", &cash);
                if(cash > cad.cred) { printf("\nSALDO INSUFICIENTE\n\n"); }
                else {
                cad.cred -= cash;
                cad.saqcred = cash;
                fwrite(&cad.cred, sizeof(int), 1, f);
                fwrite(&cad.saqcred, sizeof(int), 1, f);
                printf("\n** SAQUE DE CREDITO EFETUADO COM SUCESSO **\n");}
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("DIGITE SUA OPCAO: ");
                scanf(" %c", &m);
                 if( m == '1') movimentacao();
                 else { fim(); }
        case '4':
                printf("\nSALDO ATUAL: R$ %i,00\n", cad.s);
                printf("CREDITO ATUAL: R$ %i,00\n", cad.cred);
                printf("DEPOSITO RECENTE: R$ %i,00\n", cad.deposito);
                printf("SAQUE RECENTE: R$ %i,00\n", cad.saque);
                printf("SAQUE DE CREDITO RECENTE: R$ %i,00\n", cad.saqcred);
                printf("\n(1) MENU ANTERIOR   (2) ENCERRAR\n\n");
                printf("DIGITE SUA OPCAO: ");
                scanf(" %c", &m);
                if( m == '1') movimentacao();
                 else { fim(); }
        case '5':
                menu();
                break;
        default:
            printf("\nESCOLHA UMA OPCAO VALIDA\n");
            movimentacao();}
}