Advertisement
Fran0031

ejercicio comparar strings

Dec 30th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string.h>
  5.  
  6. int main() {
  7.     char vector[20];
  8.     char vector2[20];
  9.  
  10.     printf("Introduce la primera frase: ");
  11.     fgets(vector,20,stdin);
  12.  
  13.     printf("Introduce la segunda frase: ");
  14.     fflush(stdin);
  15.     fgets(vector2,20,stdin);
  16.  
  17.  
  18.     if (strcmp(vector,vector2)==0){
  19.         printf("Los dos vectores son iguales");
  20.     } else{
  21.         printf("Los dos vectores son distintos");
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement