I have been trying to get this code working. I have made this code mostly myself and google. I am very beginner in this, so I have no idea how to fix this.
I have tried cutting code, transforming it to c#,(modifying it of course) new file and different compiler.
#include <iostream>
using namespace std;
//suurin_luku.cpp
int question() {
double answers;
cout << "Do you want the biggest number, or smallest number?\n";
cout << "0 for biggers, 1 for smaller.\n";
cin >> answers;
if (answers == 0) {
int biggest();
}
if (answers == 1) {
int smallest();
}
return 0;
}
int biggest()
{
float input1, input2, input3;
cout << "Please insert three numbers.\n";
cin >> input1 >> input2 >> input3;
if (input1 >= input2 && input1 >= input3)
{
cout << "The largest number is: " << input1;
}
if (input2 >= input1 && input2 >= input3)
{
cout << "The largest number is: " << input2;
}
if (input3 >= input1 && input3 >= input2) {
cout << "The largest number is: " << input3;
}
return 0;
}
int smallest()
{
float input11, input22, input33;
cout << "Insert three numbers.";
cin >> input11 >> input22 >> input33;
if (input11 <= input22 && input11 <= input33)
{
cout << "The smallest number is: " << input11;
}
if (input22 <= input11 && input22 <= input33)
{
cout << "The smallest number is: " << input22;
}
if (input33 <= input11 && input33 <= input22) {
cout << "The smallest number is: " << input33;
}
return 0;
}
When user inputs 0, it shows the largest inputted number. When user inputs 1, it shows the smallest inputted number. Error codes are LNK1120 and LNK2019.