To preface this I'd like to say that THIS IS NOT HOMEWORK. I am writing this code to practice skills and learn different techniques. The challenge of this specific code is to have 3 values returned to the user using a function and if else statements only. I have successfully made what I believe to be a working function. However, my int main() outputs a zero instead of the expected 6, 12, 16 answer. Can anyone give me pointers as to where I am going wrong?
#include <iostream>
using namespace std;
int sort2(int a, int b, int c){
if (a>b && a>c){
int value1 = a;
if (b>c){
int value2 = b;
int value3 = c;
} else {
int value2 = c;
int value3 = b;
}
}
if (b>a && b>c){
int value1 = b;
if (a>c){
int value2 = a;
int value3 = c;
} else {
int value2 = c;
int value3 = a;
}
}
if (c>a && c>b){
int value1 = c;
if(a>b){
int value2 = a;
int value3 = b;
} else {
int value2 = b;
int value3 = a;
}
}
}
int main(){
int result = sort2(12,16,6);
cout<<result;
}