Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char firstWord[30];
- char secondaryWord[30];
- cout<<"Molimo upisite prvu rijec.\n";
- scanf("%s", firstWord);
- cout<<"Molimo upisite drugu rijec.\n";
- scanf("%s", secondaryWord);
- int wordOneSize = strlen(firstWord);
- int wordTwoSize = strlen(secondaryWord);
- if (wordOneSize >= wordTwoSize)
- {
- for (int i = wordOneSize; i >= 0; i--)
- {
- cout<<firstWord[i];
- }
- cout<<"\n";
- } else {
- for (int i = wordTwoSize; i >= 0; i--)
- {
- cout<<secondaryWord[i];
- }
- cout<<"\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement