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 7740215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:43:14+00:00 2026-06-01T08:43:14+00:00

I know there should be a simple fix for this, but im braindead at

  • 0

I know there should be a simple fix for this, but im braindead at the moment.

I have some count variables set up:

int gate1count, gate2count, gate3count;

gate = 1;
gate1count ++;

But in some places, I have:

gate = someint;

How can I increment the appropriate counter depending on what “someint” is?

EDIT:

Ok, the user can select a gate from a drop down menu. This is what “someint” represents.
So if they select a gate from the dropdown, I need to increment that gate counter.

  • 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-01T08:43:16+00:00Added an answer on June 1, 2026 at 8:43 am

    You can use an array instead of 3 different gates.

    int[] gateCount = new int[3];
    int gateIndex = someInt;
    gateCount[gateIndex]++;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are many things that all programmers should know, but I am particularly interested
Is there a set of things that every JavaScript programmer should know to be
What are some key UI design tips that every developer should know? While there
I know there is a standard behind all C compiler implementations, so there should
As we know to generate a class file there should be atleast one class
Is there anything I should know before converting a large C++ program from VS2005
Are there any VC++ settings I should know about to generate better PDB files
Are there any open-source libraries that all programmers should know about? I'm thinking something
I don't know if I should test my @Entity-annotated Pojos. After all, there are
This question goes beoynd just programming, but I'd like to get some input on

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.