Help with while, do while, and for loops

I'm about 3 weeks into my C++ class. I already made a simple program below that calculates grade averages and received an A. Now my teacher wants me to turn in three variations of it, replacing the goto with a while, do while, or for loop. I have experimented and researched for hours and hours, and I am totally frustrated. Here is my program:

>void main()
This is not, and never has been, correct C++. The C++ specification requires main to return an int.

>Never ever ever use goto stmts.
Normally I'd call you a moronic conformist, but you've shown yourself to be fairly knowledgeable. So I'll give you a chance to argue your case and then consider taking back the "never ever ever" part before I become the evil voice of reason.

>void main()
This is not, and never has been, correct C++. The C++ specification requires main to return an int.

>Never ever ever use goto stmts.
Normally I'd call you a moronic conformist, but you've shown yourself to be fairly knowledgeable. So I'll give you a chance to argue your case and then consider taking back the "never ever ever" part before I become the evil voice of reason.

Oh man, you even don't know the down side of "goto" stmt in C++? Crab, well then i should not waste my time replying to your posts.

>you even don't know the down side of "goto" stmt in C++?
I'm familiar with both sides of the argument, and I'm in a unique position to argue that goto does have it's uses even though most of the time it should be avoided. An unthinking ban is stupid.

>well then i should not waste my time replying to your posts.
Now you're just bitter that I've been questioning your knowledge.

Oh man, you even don't know the down side of "goto" stmt in C++? Crab, well then i should not waste my time replying to your posts.

The much maligned goto statement has a good and healthy reason to be part of the language. One of the best reasons is the escape from a nested loop. It also makes some code much easier to discern. I personally value both Intel's and Narue's input, so lets get back into the sandbox!

The much maligned goto statement has a good and healthy reason to be part of the language. One of the best reasons is the escape from a nested loop. It also makes some code much easier to discern. I personally value both Intel's and Narue's input, so lets get back into the sandbox!

Seriously. It's a help forum here. Isn't a little counterproductive to go,

you don't know why you shouldn't use goto? Well, I'm not going to tell you!!! :p

C provides the infinitely-abusable goto statement, and labels branch to. Formally, the goto statement is never necessary, and in practice it is almost always easy to write code without it. The goto statement was once widely used. Unfortunately code that used goto extensively was poorly structured and could easily become unmanageable, and is known as "spaghetti code". Today, programming languages provide other ways to structure code so goto is rarely needed. In C++ it is always possible to use something other than goto to achieve what you need.

Note that the use of goto is a religious issue and has provoked a great deal of debate. In C++ there is always a better alternative for writing loops, so you don't need to use goto at all. There are other circumstances where goto may be more appropriate than the alternatives, though that is a seperate subject. Keep in mind when you use it to exit a block which contains aggregates requiring destructors, the destructors will run before the goto transfers control. The compiler still forbids using goto to enter a scope that requires constructors.

The indiscriminate use of goto statements has caused tangled, miserable, impossible-to-read programs. To avoid the use of goto, more sophisticated, tightly controlled looping commands have been introduced: for, while, and do-while. Using these makes programs more easily understood, and goto is generally avoided, but one might argue that the case has been a bit overstated. Like any tool, carefully used and in the right hands, goto can be a useful construct, and the ANSI committee decided to keep it in the language because it has its legitimate uses.

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...