Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //IFF - Introdução à Programação
- //Slide - Página 42 - Exercício 2
- #include<stdio.h>
- #include<locale.h>
- #include<string.h>
- int main(){
- setlocale(LC_ALL,"Portuguese");
- char conteudo[11], tamanho[11], frase1[80], frase2[80];
- printf("Entre com a primeira frase: ");
- gets(frase1);
- printf("Entre com a segunda frase: ");
- gets(frase2);
- printf("Tamanho de \"%s\": %d. \nTamanho de \"%s\": %d.", frase1,strlen(frase1),frase2,strlen(frase2));
- if (stricmp(frase1,frase2)==0) strcpy(conteudo,"iguais"); else strcpy(conteudo,"diferentes");
- if (strlen(frase1)==strlen(frase2)) strcpy(tamanho,"iguais"); else strcpy(tamanho,"diferentes");
- printf("\nAs duas strings tem tamanhos %s.\nAs duas strings tem conteúdos %s.",tamanho,conteudo);
- }
Advertisement
Add Comment
Please, Sign In to add comment