Increment number of variables?

This is a discussion on Increment number of variables? within the C++ Programming forums, part of the General Programming Boards category; Is it possible to make an increasing set of variables? I.E. Input: Amount of variables you want Output: said amount ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    117

    Increment number of variables?

    Is it possible to make an increasing set of variables?

    I.E.
    Input: Amount of variables you want
    Output: said amount of variables (similar names, i.e. C1, C2, C3...)

    or

    Input: Nothing
    Output: Incrementing amount of variables with similar names (like a type of infinite loop)

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,528
    Well, put the values in a std::vector and run it through a for_each; giving an 'increment' function as an argument.
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just weird...I have the same number of variables
    By arti in forum C Programming
    Replies: 2
    Last Post: 05-13-2010, 11:37 PM
  2. 2 largest number,3 variables only
    By freddyvorhees in forum C++ Programming
    Replies: 2
    Last Post: 08-01-2008, 08:13 AM
  3. number of variables
    By Saimadhav in forum C++ Programming
    Replies: 1
    Last Post: 08-01-2008, 07:06 AM
  4. Declaring an variable number of variables
    By Decrypt in forum C++ Programming
    Replies: 8
    Last Post: 02-27-2005, 04:46 PM
  5. Variables number of arguments error
    By xErath in forum C Programming
    Replies: 3
    Last Post: 11-19-2004, 10:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21