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

  • SEARCH
  • Home
  • 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 7835607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:42:44+00:00 2026-06-02T13:42:44+00:00

I’m testing my roulette classes but visual studio don’t let me see the output

  • 0

I’m testing my roulette classes but visual studio don’t let me see the output since cin.ignore() does not work, and I have no idea what going on here,

can you explain why my cmd line window disapear and why cin.ignore() in this code never gets invoked?

Thank you so much!

#include "Bet.h"
#include "Table.h"
#include <iostream>

using namespace std;
using namespace Roulette;


int main()
{
    cout << "Enter numbers for Split bet:" << endl;
    short answer;
    vector<short>* Selection = new vector<short>;
    for (short i = 0; i < 2; ++i)
    {
        cin >> answer;
        Selection->push_back(answer);
    }

    cout << "Enter how many chips and chip worth:" << endl;
    short chips, worth;
    cin >> chips >> worth;

    Bet* MyBet = new Bet(TableLayout::European, BetName::Split, chips, worth, Selection);

    Bet* Complex = new Bet(TableLayout::European, BetName::VoisinsDeZero, 1, 1);

    Complex->PrintProperties();

    cin.ignore(); // THIS IS IGNORED!!! WHY??? please...

    delete Selection;
    Selection = nullptr;
    delete Complex;
    delete MyBet;
    return 0;
}

EDIT:

I press F5 to run a program and then type in the numbers as follows:

1 enter
2 enter
1 enter
1 enter

and here cmd goes away, program skips cin.get() ( or cin.ignore() ) whatever it doesn’t work.

  • 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-02T13:42:45+00:00Added an answer on June 2, 2026 at 1:42 pm

    cin >> chips >> worth;

    On this line, for example, if you type the last 1 and press enter, A \n is still left in the stream unread.

    When you do cin.ignore();, it extracts the leftover character and the program finishes. Change cin.ignore(); to cin.ignore(2); and it should work.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I want to construct a data frame in an Rcpp function, but when I
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.