Solved

writing a value to a methd from another class using a loop

Posted on 2008-10-23
3
168 Views
Last Modified: 2013-11-23
i have a program that needs to write values to a method from another class, this method writes values to a popup for colours etc..  at first i am just trying to get the values in the for loop to get passed back to the .pix class (which already has the required code for the popup etc..)
so i just want it to loop through the values one by one until ver reaches 256, at the moment the values in the declaration i.e. 33, 0, 55, 2 appear but that it is it, the for loop does not have any effect?  hope this is clear, as you can gather I am new to this!!!  the code below is just a snippet...

int hor = 33;
int ver = 0;
int length = 55;
int shade =2;
            
plotdavey.pix(hor, ver, length, shade);
            
       for (ver=0;ver<256;ver++) {
              hor = hor++;      
                     length = length++;      
             shade = shade++;
}
0
Comment
Question by:ckawebcreation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
divyeshhdoshi earned 80 total points
ID: 22784286
You should use
 for (ver=0;ver<256 && hor<256 && length<256 && shade < 256;ver++) {
              hor = hor++;      
                     length = length++;      
             shade = shade++;
0
 

Author Comment

by:ckawebcreation
ID: 22784542
hi divyeshhdoshi,

i got it working now thanks, i have another problem, i am being a bit vague because i am creating the program bit by bit and because i am a beginner i have to get the basicas working first..  What i have now is the code below.

it will draw the lines if I use the commented out for loop but if I use the count for loop it gives me an error, the reason for the for loop is to create a line that is set to the awidth (which gets declared early on) and once it reaches the awidth, start reading the next line and so on until it runs out of numbers and all the lines have been drawn revealing an image.

the error is > expected for (count=count+length;<awidth;)  --- and it has an arrow pointing at the semi-colon after the h?  

any pointers would be great!!!!


            int hor = 0;
            int ver = 0;
            int length = 0;
            int shade = 0;
            int count =0;      
                        
             //      for (ver=0;ver<256;ver++) {
                    
                    for (count=count+length;<awidth;) {
                    hor = hor;      
                         length = inputFile.nextInt();      
                         shade = inputFile.nextInt();
                         count = length +shade;
                         plotdarryl.plot(hor, ver, length, shade);
                   
                          }


0
 

Author Comment

by:ckawebcreation
ID: 22786180
cheers divyeshhdoshi:
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question