Created
May 21, 2018 07:07
-
-
Save Zemaaan/3fd8367602324956cfb1fce0a5da45fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ConsoleApplication1.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <iostream> | |
#include <string>; | |
using namespace std; | |
int main() | |
{ | |
int prvi_broj = 0; | |
int drugi_broj = 0; | |
int najveci_prvi = 0; | |
int najveci_prvi_indeks = 0; | |
int najveci_drugi = 0; | |
int najveci_drugi_indeks = 0; | |
cin >> prvi_broj; | |
cin >> drugi_broj; | |
if (prvi_broj > drugi_broj) { | |
string string_od_prvoga = to_string(prvi_broj); | |
for (int pozicija = 0; pozicija < string_od_prvoga.length(); pozicija++) { | |
if (string_od_prvoga[pozicija] > najveci_prvi) { | |
najveci_prvi = string_od_prvoga[pozicija]; | |
najveci_prvi_indeks = pozicija; | |
} | |
else { | |
string string_od_drugoga = to_string(prvi_broj); | |
for (int pozicija = 0; pozicija < string_od_drugoga.length(); pozicija++) { | |
if (string_od_drugoga[pozicija] > najveci_drugi) { | |
najveci_drugi = string_od_drugoga[pozicija]; | |
najveci_drugi_indeks = pozicija; | |
} | |
} | |
} | |
system("pause"); | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment