Advertisement
ProgramoBien

Problema 2

Feb 7th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include<stdio.h>
  2. #include <string.h>
  3. //#include <cstring>
  4.  
  5. #define MAX 255
  6.  
  7. int main() {
  8.     char nom[MAX],ap1[MAX],ap2[MAX];
  9.     printf("Tu nombre: ");
  10.     scanf("%s", nom);
  11.     printf("Tu primer apellido: ");
  12.     scanf("%s", ap1);
  13.     printf("Tu segundo apellido: ");
  14.     scanf("%s", ap2);
  15.     char nombre_completo[100];
  16.     strcpy(nombre_completo, nom + ' ');
  17.     strcat(nombre_completo,ap1);
  18.     strcat(nombre_completo,ap2);
  19.     printf("%s",nombre_completo);
  20.     printf("%s",nom);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement