Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Uporedjivanje stringova.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <stdio.h>
- #ifndef __boolean
- typedef unsigned char bool;
- static const bool False = 0;
- static const bool True = 1;
- #endif
- int main()
- {
- char s1[80], s2[80];
- int n1;
- bool isti = True;
- printf("Unesi dva stringa :\n");
- gets(s1);
- gets(s2);
- pocetak:
- printf("Unesi broj karaktera za uporedjivanje: \n");
- scanf("%d", &n1);
- if (n1 > strlen(s1) || n1 > strlen(s2))
- {
- printf("Uneti broj je veci od duzine stringa\n\n");
- goto pocetak;
- }
- for (int i = 0; i < n1; i++)
- {
- if (s1[i] == s2[i])
- {
- isti = True;
- continue;
- }
- else
- {
- isti = False;
- break;
- }
- }
- if (isti)
- printf("Isti!\n");
- else
- printf("Razliciti!\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement