Hi ,

pls i need your help .
i write algorithm that calculate prefix average

..

sum=0
for i=1:n do
sum =suma+a
b=sum/i
return array b

my teacher said , write above code using insted for ..
how i can use the other for ..

what are your opinion?

I'm afraid we're going to need more information. It's not real clear what you're trying to accomplish.

A nested for loop is nothing more than a for loop inside another statement block of some sort, such as another for loop.

for (int i = 0; i < limitingValue1; ++i) { //outer loop
  //statements here
  for (int j = 0; j < someOtherLimit; ++j) {  //inner / nested loop
    //statements here
  }
  //statements here
}

yes , I know its a simple thing , i write like you but i lost .
which statement should be first ,and which should be in inner statement and outer statement

...

Thank you for your answer but is can explain pls

Your algorithm is pretty simple, but your intent isn't clear. We really can't give you any direction unless you share your assignment's goals and/or make your intentions clearer. I would advise you to post the code you have written to this point as well. Without that code and more information about what specifically you are trying to accomplish all we can do is make wild guesses.

If you have more than one index that you need to modify/track, and they need to move somewhat independently of each other, each index should be managed by its own loop. That's really all I can tell you.

Maybe something like this will help.

yes , the content of link is very clear for me ..


thank you so much my dear .

can I ask you if you have more slides about algorithms

sory , i edit my Thread

because i dont know how i can explain for you .
and i didnt see that link you put .
when i see iam understand how i can solve my problem thanks


.. if you have other links that explain algorithm ..pls put here

yes , the content of link is very clear for me ..


thank you so much my dear .

can I ask you if you have more slides about algorithms

That's not my file. It's one that Google turned up.

Hi, I am new to using C++ and i have to write a program that asks the user how many test scores they have, and then reads the test scores, averages them, and displays the average and a pass/fail grade appropriate for that average (such as, "passing is 50 or higher, failing is below 50"). use a separate function to average the input values.
I would appreciate any help thanks

Hi, I am new to using C++ and i have to write a program that asks the user how many test scores they have, and then reads the test scores, averages them, and displays the average and a pass/fail grade appropriate for that average (such as, "passing is 50 or higher, failing is below 50"). use a separate function to average the input values.
I would appreciate any help thanks

That is a ridiculously easy program. I suggest:

  1. You actually show some effort first.
  2. Don't hijack threads, start your own.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.