okay i am trying to compare a char thats a constant with a char that a person has inputed however this is as far as i have gotten and its not working.

#include <iostream>
using namespace std;

int main()
{
    char input[20];
    char correct [] = "Rudolf";
    cin >> request;
if (char request[] = char correct[])
    {
              cout << " correct";
    }
    else
    {
              cout << "incorrect";
     }
}

Any help is appreciated!! ;)

Aside from the major syntax and naming issues:

thats because your array of 20 looks like

Rudolf00000000000000
--------------------

// each 0 is actually a null character

where as the array you specify looks like this

Rudolf
------

try this: It does a case-sensitive comparison, such as "Rudolf" is not the same as "rudolf"

#include <iostream>
using namespace std;

int main()
{
    char input[20];
    char correct [] = "Rudolf";
    cin >> input;
if (strcmp(input, correct) == 0)
    {
              cout << " correct";
    }
    else
    {
              cout << "incorrect";
     }
}
This question has already been answered. Start a new discussion instead.