Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 17th, 2004, 04:04 PM
Authorized User
 
Join Date: Aug 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default how it can be done

if the number of generating " myArray[i]" for many times depends on a number entered by the user.

for example:.
if the user enter 3

- the program will generate it something like the following

myArray[i] + myArray[i+1] + myArray[i+2] // (1)

else if the user enter 4
the following will be generated

myArray[i] + myArray[i+1] + myArray[i+2] + myArray[i+3] // (2)


i need to use the result of (1) or (2) in another "for loop", as

for(int i =0;i<10;i++)
{
// the problem how to get the following from the previous (1) or (2)
// to make " i " used by the second for loop
myArray[i] + myArray[i+1] + myArray[i+2]

}

 in other words
-------------------
i mean that:

1- i don't need sum to be int, i need it as string - any datatype - that helps me to produce some of myarray elements in the form " 1,2,3" - separated by commas.

2- second, look at the follwing example

if i get f(x) = 2x+3

suppose that 2x+3 is generated by for loop and f(x) the object which contains this equation how can i use this equation not the object in another piece of code i.e in another method.

NOW i think you got my question correctly.



 
Old October 20th, 2004, 06:12 AM
Authorized User
 
Join Date: Aug 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

please i need your help

in other words
----------------
look:>>

y = "myArray[i]" // where y is string

after i make this equation that was generated by any way...

i need to use "myArray[i]" in a for loop

for example:

for(i=0;i<10;i++)
{

Console.writeline(myArray[i]);

/*here " myArray[i] was gotten from the above equation - y="myArray[i]" which was generated by someway and i don't know what is the result from that way.*/

}


please if you don't understand it again tell me what you don't understand and i will show it for you.

 
Old October 20th, 2004, 01:43 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,
you can use ArrayList objects,
Code:
//n is the capacity of your arraylist you get it from user
ArrayList a=new ArrayList(n);
for(int i=0;i<=a.Capacity-1;i++)
{
    a.Add(i);
    textBox2.Text+=a[i].ToString()+",";
}
if you need to use your ArrayList in several methods you should declare it globally,
HtH.

--------------------------------------------
Mehdi.:)
 
Old October 23rd, 2004, 06:17 PM
Authorized User
 
Join Date: Aug 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can you help me doing this program
i need to make the program to take a number between 2,9

and the program make possible combinations in form of sets where {1,2} the same as {2,1}
i don't need the program to display both sets.

also when you give the program a number between 2,9
for example :
for 2
{1,2}
for 3
{1,2,3}
for 4
{1,2,3,4}

and continue displaying all possible combination in a form of sets which contains a number of elements specified by the user of the program.

if you don't understand me please post a reply.






 
Old October 24th, 2004, 05:50 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

continued here.

--------------------------------------------
Mehdi.:)









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.