Jun 1, 2018 at 7:21pm UTC
I'm getting an error: "variable or field 'biggestNumb' declared void." I have a task to tell the console 3 integers and it has to sort out the greatest one. I'm a very beginner to the C++ so you may find this code a bit messy. Anyway, here it is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include <iostream>
#include <Windows.h>
using namespace std;
int number1, number2, number3;
void biggestNumb(number1, number2, number3)
{
if (number1>number2&&number1>number3)
{
cout << endl;
cout << number1;
}
else if (number2>number1&&number2>number3)
{
cout << endl;
cout << number2;
}
else if (number3>number1&&number3>number2)
{
cout << endl;
cout << number3;
}
}
int main()
{
cin >> number1;
cin >> number2;
cin >> number3;
biggestNumb(number1, number2, number3);
}
Last edited on Jun 1, 2018 at 7:23pm UTC
Jun 1, 2018 at 8:57pm UTC
Thanks, that worked out :) Yeah earlier I used the Sleep() function and removed it and forgot to remove Windows.h Thanks for your help