Advertisement
MeydinN

Untitled

May 27th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3. #include <conio.c>
  4. #include <stdio.h>
  5. #include <string.h>
  6.  
  7. void main()
  8. {
  9. cout<<"Ingrese cadena 1: ";
  10. char Cad1[100], Cad2[100], Cad3[100];
  11. gets(Cad1);
  12. cout<<"\tSu longitud es: "; strlen(Cad1)<<endl;
  13. cout<<"Ingrese cadena 2: ";
  14. gets(Cad2);
  15. cout<<"\tSu longitud es: "<<strlen(Cad2)<<endl;
  16. cout<<"\nCopia de cadenas"<<endl;
  17. strcpy(Cad3,Cad1)
  18. cout<<"\tLa cadena 3 contiene: "<<endl;
  19. cout<<Cad3<<endl; strcpy(Cad3,Cad1);
  20. cout<<"\nCOncatenación de cadenas"<<endl;
  21. strcat(Cad1,Cad2);
  22. cout<<"\tLa cadena 1 contiene ahora: ";
  23. cout<<endl<<Cad1<<endl;
  24. getch(); strcpy(Cad1,Cad3);
  25. cout<<"\nComparacion de cadenas"<<endl;
  26. if(strcmp(Cad1,Cad2)<0)
  27. cout<<Cad1<<"[ANTES DE]"<<endl<<Cad2<<endl;
  28. else if(strcmp(Cad1,Cad2)==0)
  29. cout<<Cad1<<"[IGUAL A]"<<endl<<Cad2<<endl;
  30. else
  31. cout<<Cad1<<"[DESPUES DE]"<<endl<<Cad1<<endl;
  32. getch();
  33. int NPal=0;
  34. for(j=0;j<strlen(Cad1);j++)
  35. if(Cad1[j]=='')NPal++;
  36. cout<<"\n"<<Cad1<<" contiene"<<NPal<<" palabras"<<endl;
  37. getch();}
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement