Write a complete program that reads three integers from the console and outputs the number of distinct values entered. For example if the input is 34 55 23 then the output will be 3, since there are three distinct values . If the input is 42 78 42 then the output will 2 since there are two distinct values . Finally, if the input is 67 67 67 then the output will be 1 since there is just one distinct value .
Here is my source code:
#include<iostream>
using namespace std;
int main()
{
int a, b, c, distinct;
cin >> a >> b >> c;
if(a != b && b != c && a != c)
{
distinct++;
cout << distinct << endl;
}
else if((a != b && b != c && a == c)
|| (a == b && b == c && a != c)
|| (a != b && b == c && a != c) || (a == b && b != c && a != c))
{
distinct++;
cout << distinct << endl;
}
else
{
cout << distinct << endl;
}
return 0;
}
Here is my input:
34 55 23
Here is my output:
1
Here is the expected output I want to get:
3
Is there anyway I can fix this?