Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- cout<<"Unesite tip vrednosti: int,float,double: ";
- string a;
- cin>>a;
- if (a == "int"){
- cout<<"Unesite broj tipa int: ";
- int b;
- cin>>b;
- cout<<"Drugi: "
- int c;
- cin>>c;
- f = funk1(b,c);
- cout<<"Rezultat: "<<f;
- }
- else if (a == "float"){
- cout<<"Unesite broj tipa float: ";
- float b;
- cin>>b;
- cout<<"Drugi: "
- float c;
- cin>>c;
- f = funk2(b,c);
- cout<<"Rezultat: "<<f;
- }
- else if(a == "double"){
- cout<<"Unesite broj tipa double: ";
- double b;
- cin>>b;
- cout<<"Drugi: "
- double c;
- cin>>c;
- f = funk1(b,c);
- cout<<"Rezultat: "<<f;
- }
- }
- int funk1(int n,int m){
- cout<<"n = "<<n;
- cout<<"\nm = "<<m;
- cout<<"\nsum = "<<n+m;
- cout<<"\ndiference = "<<n-m;
- cout<<"\nproduct = "<<n*m;
- cout<<"\nratio = "<<n/m;
- if (n<m){
- cout<<"\nsmaller: "<<n
- }
- else if (m<n){
- cout<<"\nsmaller: "<<m
- }
- else if (n == m){
- cout<<"\nnumbers are same"
- }
- }
- float funk2(float n,float m){
- cout<<"n = "<<n;
- cout<<"\nm = "<<m;
- cout<<"\nsum = "<<n+m;
- cout<<"\ndiference = "<<n-m;
- cout<<"\nproduct = "<<n*m;
- cout<<"\nratio = "<<n/m;
- if (n<m){
- cout<<"\nsmaller: "<<n
- }
- else if (m<n){
- cout<<"\nsmaller: "<<m
- }
- else if (n == m){
- cout<<"\nnumbers are same"
- }
- }
- double funk3(double n,double m){
- cout<<"n = "<<n;
- cout<<"\nm = "<<m;
- cout<<"\nsum = "<<n+m;
- cout<<"\ndiference = "<<n-m;
- cout<<"\nproduct = "<<n*m;
- cout<<"\nratio = "<<n/m;
- if (n<m){
- cout<<"\nsmaller: "<<n
- }
- else if (m<n){
- cout<<"\nsmaller: "<<m
- }
- else if (n == m){
- cout<<"\nnumbers are same"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement