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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:08:48+00:00 2026-05-30T09:08:48+00:00

I need a tip in creating a C++ utility. I’m implementening an optimization algorithm,

  • 0

I need a tip in creating a C++ utility.
I’m implementening an optimization algorithm, and at a certain step, I would need to create as much new variables as the iterations of a cycle.
There’s some code that would explain it better:

for(int i=1;i<112;i++){
   struct nodo n_2i[111-i];           
}

The structure nodo is defined as:

struct nodo{
  int last_prod;
  int last_slot;
  float Z_L;
  float Z_U;
  float g;
  bool fathomed;
};

I would like the names of the new variables (arrays of structures) to be n_21,n_22,n_23,…etc.
How can I handle that?

  • 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-05-30T09:08:50+00:00Added an answer on May 30, 2026 at 9:08 am

    Why do you need the name to be n_21. you can use a vector of vector.

    #include <vector>
    using namespace std;
    int main() {
        vector<vector<struct nodo> > n;
        for(int i=1;i<112;i++){
            n.push_back(vector<struct nodo>(111-i));       
        }
        // you can use n[0] ... n[111] now
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a quick tip on using new File(File dir, String file) . I'm
I need to show tool tip text in multiple lines, but setTitle() method in
So what i need is a query or some tip on how to turn
I'd like to create an index on a view I have but I need
i need help regarding dokuwiki i want to remove versioning from wiki. any tip
I am creating a report where I need to indent a row in a
I am sort of new to TDD. I have started creating the properties I
I need fast&easy tip. I'm tempted to 'socialize my website' a little,so I gave
I need a tool tip. By hover the text, the tool tip will appear.
I'm trying to code a console minigame (for fun), and I need to create

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.