Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7873631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:34:24+00:00 2026-06-03T02:34:24+00:00

The problem with this code is that there are no errors showing, but when

  • 0

The problem with this code is that there are no errors showing, but when i compile the program, the if else statements do not carry out as they should do. Both if statements show the same answer, for example the second if statement. If I type Y or N then I get the same thing, ‘You will now choose an event’. How do i get rid of this problem? Is char supposed to be used or string?

#include <iostream>
#include <iomanip>
#include<stdlib.h>
class start
{
public :
    void getusertype ();
    void registeruser ();
    start(); 
protected :
    char consumer_name[20],
    consumer_address[30],
    consumer_email[30];
    char user[8];
};

start::start()
{
    char terminator;
    cout <<"Are you the venue manager, consumer or ticket agent?";
    cin.get(user,8);
    cin.get(terminator);

}
void start::getusertype ()
{
    char terminator;
    if(user[8])
    {
        cout <<"You have now entered the system." <<endl <<endl;
        cin.get(terminator);

    }
    else
    {
        cout <<"You can only enter this part of the system if you are a consumer.";
    }

    }
void start::registeruser()
{
    char option[1];
    cout <<"Are you registered? (Enter Y/N)";
    cin.get(option,1);
    if (option=="N")
    { char terminator;
        cout <<"Please enter your registration details" <<endl <<endl;
        cout << " Enter your full name: " <<endl;
        cin.get (consumer_name,20);
        cin.get(terminator);
        cout <<"Enter your address: " <<endl;
        cin.get(consumer_address,30);
        cin.get(terminator);
        cout <<"Enter your email address: " <<endl;
        cin.get(consumer_email,30);
        cin.get(terminator);
    }
    else
    {
        cout <<"You will now choose an event.";
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:34:25+00:00Added an answer on June 3, 2026 at 2:34 am

    If you really want to use char [] rather than std::string (which has an operator== and clearly acts more like what you expect) you’ll need to edit your if statement to use the old C-way of doing string comparisons. Something like:

    if ( strcmp(option, "N") == 0)
    {
      // ...
    }
    

    Or since you are comparing only one character you could just do:

    if ( *option == 'N' )
    {
      // ...
    }
    

    This dereferences the pointer to the first character in that char [] which is a primitive type and so can be compared directly with ==.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm showing the code to this problem for example purposes, but really my question
I got this code today that works for jQuery v7. The problem is that
I am trying to solve this exponentiation problem . Here is the code that
The Problem I'm receiving crash reports from users that look like this: Code Type:
i am a beginner and i have a problem : this code doesnt compile
This code is a linked list implementation of a stack that solves postfix problems
Hi i have problem with this code, i found it on the internet and
I have problem with this code: file = tempfile.TemporaryFile(mode='wrb') file.write(base64.b64decode(data)) file.flush() os.fsync(file) # file.seek(0)
What is the problem with this code? How to solve it? Parent processes goto
I have a problem with this code right here: - (void)fetchedData:(NSData *)responseData { //parse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.