Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- using namespace std;
- int main() {
- string R;
- string S;
- bool nijeBroj = false;
- do {
- nijeBroj = false;
- cout << "Upisite R: ";
- cin >> R;
- cout << "Upisite S: ";
- cin >> S;
- for(int i = 0; i < R.length(); ++i) {
- if(!isdigit(R[i]))
- nijeBroj = true;
- }
- for(int i = 0; i < S.length(); ++i) {
- if(!isdigit(S[i]))
- nijeBroj = true;
- }
- }while(nijeBroj);
- int r;
- int s;
- istringstream c1(R);
- c1 >> r;
- istringstream c2(S);
- c2 >> s;
- if(r >= s) {
- cout << r << " " << s;
- } else
- cout << s << " " << r;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment