I am trying to get a coding assignment done and I am getting to the part where I need to code it so the user can input a character to make a decision. For the assignment I am required to store the variable as a string, so I have been trying to use the get line() function to allow for the input. The problem that I am having is when I run the program it doesn't allow for me to input any string character at all and instead just runs right through the error check. Lines 30 and 31 are where I am having trouble, any help would be appreciated.
#include <iostream>
#include <cmath>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
//Variable Declarations
double num1,num2;
string input;
//step 1
cout<<"ECE 0301 - Vectors in R2 and Complex Numbers\nPlease enter two numbers, separated by a space,\nthat will represent a vector or a complex number."<< endl << endl;
//step 2
//asking for input
cin>> num1 >> num2;
//outputting
cout << setprecision(3) << fixed << "You entered " << num1 << " and " << num2 << "." << endl;
//step 3
cout <<"\nAre these numbers in Cartesian (C) or polar (P) coordinates?\nPlease enter a single character as your choice.\n";
getline(cin,input);
//error check
if(input != "c" || input != "C" || input != "p" || input != "P")
{
cout <<"\nERROR! Invalid selection,exiting.";
return 0;
}
return 0;
}