i have problems with if- else statements

how can i make this code works?
it is supposed to give me "Unable to make a diagnosis" only when i answer the questions with characters other than 'y' or 'n', but i don't know how to do it.
can somebody tell me what's wrong?
A response will be very appreciated.

i just have 2 weeks learning c++

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  #include <iostream>
#include <string>
using namespace std;

int main()
{
    
    // NOTE - Assume that the user always provides valid input
	
    char fever; // 'y' if the user has a fever
    char stuffy; // 'y' if the user has a stuffy nose
    char rash; // 'y' if the user has a rash
    char earHurts; // 'y' if the user's ear hurts
    
	
    cout << "Disclaimer -- This should not be used for a real medical diagnosis" 
	<< endl << endl;

	/////////////////////////
	// Start of your code

	// Ask the user if he has a fever
	cout << "Do you have fever? (Y/N) "; 
	cin >> fever;
	
	
	// Ask the user if he has a stuffy nose
	cout << "Do you have a stuffy nose? (Y/N) ";
	cin >> stuffy;
	
	
	// Ask the user if he has a rash
	cout << "Do you have a rash? (Y/N) "; 
	cin >> rash;
	
	// Ask the user if his ear hurts
	cout << "Do your ears hurt? (Y/N) "; 
	cin >> earHurts;
	
	
	// Using if - else if - else statments with complex conditions, make
	// a diagnosis. If the user enters characters other than 'y' or 'n', 
    // print "Unable to make a diagnosis"

  if (fever != ('Y') || ('N')) {
      cout << "Unable to make a diagnosis. " << endl;
  }
  else if (stuffy != ('Y') ||  ('N')) {
      cout << "Unable to make a diagnosis. " << endl;
  }
  else if (rash != ('Y') || ('N')) { 
      cout << "Unable to make a diagnosis. " << endl;
  }
  else if (earHurts != ('Y') || ('N')) {
      cout << "Unable to make a diagnosis. " << endl;
  }
  
	// End of your code
	/////////////////////////

	system("pause");
	
	return 0;
}
Last edited on
Try
if (fever != ('Y') && ('N'))
Topic archived. No new replies allowed.