Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
If/else help
Post Flair (click to view more posts with a particular flair)
Post Body

When a user answers the question are they taking a class, no matter what they enter to goes straight to asking what's their grade. How am I using the if else statement wrong?

#include <iostream>
using namespace std;

int main()
{
  char classYN, grade;

  cout << "Are you taking a class? (Enter Y,y, N, or n) " << endl;
  cin >> classYN;

  if (classYN  == 'y' || 'Y')
    {
      cout << "Please enter a letter grade: " << endl;
      cin >> grade;
    }
  else if (classYN  == 'n' || 'N')
      {
      cout << "Thanks for using the system." << endl;
      }
  else
    {
      cout << "Invalid input" << endl;
    }

  switch (grade)
    {
    case A || B:
      cout << "Great job!" << endl;
      break;
return 0;

 }

Author
Account Strength
80%
Account Age
8 years
Verified Email
Yes
Verified Flair
No
Total Karma
146
Link Karma
1
Comment Karma
145
Profile updated: 4 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
7 years ago