// Função menu void menu() { short int opcao = 1; while(opcao != 0) { printf("\n" "|--------------------------|\n" "| Bem-vindo! |\n" "|--------------------------|\n" "| SELECIONE UMA OPCAO: |\n" "| 1: CONCATENAR STRING |\n" "| 2: COMPARAR STRING |\n" "| 3: COPIAR STRINGS |\n" "| 4: TAMANHO DA STRING |\n" "| 0: SAIR |\n" ); scanf("%d", &opcao); system("cls"); switch(opcao) { case 0: printf("\nFim da execucao!\n"); return; case 1: printf("\n---- CONCATENAR STRING ----\n"); concatena(); break; case 2: printf("\n---- COMPARAR STRING ----\n"); compara(); break; case 3: printf("\n---- COPIA STRING ----\n"); copia(); break; case 4: printf("\n---- TAMANHO DA STRING ----\n"); tamanho(); break; default: printf("OPCAO INVALIDA!\n"); } } }
void __fastcall TForm1::Memo1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { char coordenadas[15]; int i; if (Estado->Caption == "&Enviar") { memset(&coordenadas, '\0', sizeof(coordenadas)); strcat(coordenadas, concatena(Mouse->CursorPos.x, Mouse->CursorPos.y)); for (i=0; coordenadas[i] != '\0'; i++) { Sleep(5); TransmitCommChar(hComm, coordenadas[i]); } } }
int main(void) { Lista* l = (Lista*) malloc(sizeof(Lista)); l = lst_cria(); l = lst_insere(l, 73); l = lst_insere(l, 44); l = lst_insere(l, 34); Lista* l2 = (Lista*) malloc(sizeof(Lista)); l2 = lst_cria(); l2 = lst_insere(l2, 22); l2 = lst_insere(l2, 14); l2 = lst_insere(l2, 8); l2 = lst_insere(l2, 5); concatena(l, l2); }
int main() { short i, j, k, n; cadena a[256]; scanf("%hd", &n); getc(stdin); gets(a[0].num); for(i = 0; i < n; i++) { j = 0; while(strcmp(gets(a[j++].num), "") != 0); j -= 2; puts(concatena(a, j)); } return 0; }
main(){ char texto[81], texto2[81]; printf ("Digite uma string: "); scanf(" %80[^\n]s", texto); QL; printf("O tamanho da cadeia: %s eh %d", texto, comprimento(texto)); QL; imprime(texto);QL; // exibe(texto); copia(texto2, texto); QL; imprime(texto2);QL; imprime(texto);QL;QL; printf ("Digite uma string: "); scanf(" %80[^\n]s", texto2); QL; printf("O tamanho da cadeia: %s eh %d", texto2, comprimento(texto2)); concatena(texto, texto2);QL; imprime(texto); QL; printf("O tamanho da cadeia: %s eh %d", texto, comprimento(texto));QL; getchar(); }
int mainl11q2() { //Título do Programa e autor printf(" << UEFS - PGCA 2014.1 - Programa funcao concatena_lista_encadeada>>"); printf("\n\n ## Autor: Leonardo Melo\n\n"); Lista *lista1 = NULL; Lista *lista2 = NULL; lista *a = criaCelulaL(2.1); lista *b = criaCelulaL(4.5); lista *c = criaCelulaL(1.0); lista *d = criaCelulaL(7.2); lista *e = criaCelulaL(9.8); lista1 = a; a->prox = b; b->prox = c; lista2 = d; d->prox = e; printf("\n\nLISTA 1\n\n"); for (lista *p = lista1; p != NULL; p = p->prox) { printf("%.1f ", p->info); } printf("\n\nLISTA 2\n\n"); for (lista *p = lista2; p != NULL; p = p->prox) { printf("%.1f ", p->info); } printf("\n\nConcatenando...\n\n"); Lista *lista3 = concatena(lista1, lista2); printf("\n\nLISTA 1\n\n"); for (lista *p = lista1; p != NULL; p = p->prox) { printf("%.1f ", p->info); } printf("\n\nLISTA 2\n\n"); for (lista *p = lista2; p != NULL; p = p->prox) { printf("%.1f ", p->info); } printf("\n\nLISTA 3 (Concatenada)\n\n"); for (lista *p = lista3; p != NULL; p = p->prox) { printf("%.1f ", p->info); } //Pula duas linhas e Pausa a Tela (Utilizando comandos DOS) printf("\n\n\n"); system("pause"); //Retorno do método main return(EXIT_SUCCESS); }