You need clear() only after an error (to reset the flags). It isn't necessary here. (except if the user entered an invalid number, but that requires additional code to handle properly).
The purpose of ignore() in this context is to remove the newline character '\n' which remains in the buffer after the cin >> which otherwise is picked up by the next getline() and interpreted as an empty line.
For your second question, if you want to repeat the entire process, you need some sort of loop. Normally a while loop would be useful. But you need to decide how to exit from the loop after completing all of the input.
Well, I wouldn't call it a correction, that implies there is an error. Rather, it is a change to the design. In terms of what code you should write, first of all, you need to be clear about what it is that you are aiming to achieve. Although I could attempt to guess that, you really need to specify in words what you want to happen.
What I'm saying is, you haven't supplied enough information about the task so far. For example, I see two arrays, name and id. Each array has a size of 200 elements. But how do you intend to use these arrays? Will there be exactly 200 students? Or some variable number. How do you want the input to be entered at the keyboard? Once you have decided how the program is to behave, then it is possible to write code to implement that behaviour.
yes,those codes just one part of the all .
i have finished other parts and left this part only
i am no going to use all of the elements
just assume the maximum size of elements is 200 .
the output should let the user to enter the student name and id if user choose menu 1.
after enter name and id,user will be asked want to continue or not
if they wan,then continue,if don't, then break,
those code i haven write in but i think i can finish this part first
example of output:
(if user want continue,will ask again)