23.1.23020070. Generisati 3 različita realna broja. Ispisati ih u rastućem redoslijedu na ekran.

Opis rješenja:

Listing programa:

//23020070
#include<iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

int main(){
	srand(time(NULL));
	int a=rand()%200+(-100),b=rand()%200+(-100),c=rand()%200+(-100);
	
	cout<<a<<" "<<b<<" "<<c<<endl;
	
	if(a < b && a < c){
		if(b < c)
			cout<<a<<" "<<b<<" "<<c<<endl;
		else
			cout<<a<<" "<<c<<" "<<b<<endl;
	}
	if(b < a && b < c){
		if(a < c)
			cout<<b<<" "<<a<<" "<<c<<endl;
		else
			cout<<b<<" "<<c<<" "<<a<<endl;
	}
	if(c < a && c < b){
		if(a < b)
			cout<<c<<" "<<a<<" "<<b<<endl;
		else
			cout<<c<<" "<<b<<" "<<a<<endl;
	}
	return 0;
}

Ispis na ekranu:

Riješeni zadaci    Index