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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:10:30+00:00 2026-06-13T20:10:30+00:00

I want to generate some variables using for command. look at code below: for

  • 0

I want to generate some variables using for command. look at code below:

for (char ch='a'; ch<='z'; ch++)
      int ch=0;

It just an example, after running code above, I want to have int a, int b, int c …

another example:

for (int i=0; i<10; i++)
      int NewiEnd=0;

For example after running code above, we will have int New1End, int New2End etc.

Hope I’m clear enough, How can I do such thing in C++??

  • 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-13T20:10:31+00:00Added an answer on June 13, 2026 at 8:10 pm

    No, not possible, not exactly. However, this is possible:

    std::map<char,int> vars;    
    for (char ch='a'; ch<='z'; ch++)
          vars[ch] = 0;
    
    std::cout << vars['a'] << vars['b'] << vars['c'];
    

    You can also have std::map<std::string, int>.

    std::map<std::string,int> vars;
    for (int i=0; i<10; i++)
        vars["New" + std::to_string(i) + "End"] = 0;
    std::cout << vars["New5End"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some working Javascript code that generates an RDF/XML document using variables picked
I want to generate some test data so for each row in a table
I want to generate XML from existing xml but values should come from some
I want to generate a list of unique IDs. Because some of the IDs
I want to generate html like, <label for='field'> Label Text <span class='span1'> Some Text
On a django site, I want to generate an excel file based on some
to export some data i want to be able to generate an html output.
I have some data generated in MATLAB that I want to process using Perl.
In using ./manage.py shell to exercise some code, I've come across something I don't
I have a simple bash script where I generate some temporary files using split,

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.