I believe it's because in your void populator(student array[] , int length) function, you have for (int m=0 ; m < length ; m++) instead of for (int m=0 ; m <= length ; m++). Also, wouldn't it be easier and cleaner looking, to use switch() for the variable input instead of a bunch of if's and else if's? Just wondering..
I had too many problems running your code. You cannot use array as a variable. When something turns blue, it should be a warning to you that it cannot be a variable. Second, you cannot define an array with a number that isn't a constant. If you need an array that isn't constant, then look into vector or deque as an alternative. Lastly, since I could not run the program to see if it would work, I suspect that it didn't run properly because you did not flush it. I can't say for sure because I can't run it and don't have the time to fix all the errors. I would also set everything to getline because I remember alternating between using it and not using it caused me problems in the past. Sorry I didn't have time to fix your code, if you are still having problems with it later, I can work with it later for you.
tell me the problem. I am just a beginner. That is why I am posting in beginner. As a student those details dont matter. We want the program to work. Thats it for now.
My mistake, that thread doesn't seem to have the details (anymore?). This thread has what you need (ignoring the newline that gets left in the stream): http://www.cplusplus.com/forum/beginner/20577/
He didn't use Array, he used array and in my compiler it turned blue. I am using C# so maybe in his compiler it isn't a problem, but it was definitely in mine when I cut and paste the code to my test project.
biplav17, even though you are a beginner, the information is important to know if you are to program c/c++. So I will try to simplify it for you because even though I didn't click and read the link, I suspect I know what it says already.
When I wrote code and used getline in parts of my code while using cin for other parts, it caused problems with the iostream. You should stick to using just one or the other. I personally choose getline just because I find it easier to manipulate and test for errors. Even getting a number with getline is easy because you can test the characters to make sure they fall within number ranges while easy converting them using the sstream header and the istringstream class. I use istringstream and ostringstream in a lot of my code, it is very useful.
If you choose not to use getline, then you have to guess the maximum amount of characters someone will input and set up a char array to hold the values. Not you have potential memory problems if someone want to be a jerk and type in 60001 characters just because they know you set up the array as char[60000]. Since string expands as needed but stays small when not much space is used, it is better to use and works great with getline. Also getline can be use other ways with the third variable. The third variable is automatically defined as '\0' and you can change that to anything so instead of detecting a new line, you can detect a certain character which would be anything character including those of non alpha and numeric kind. I personally like the upside down exclamation point.
Understanding this is important because if you don't grab the issue you are having and actually understand why, then in the future you will be right back here asking again, which will waste your precious time when you could have accomplished a lot more with it. Everything people tell you here is to help you, even if it seems tedious at times. But C/C++ doesn't leave any room for error, you either perfect the code or never have the program you truly want.
You can use them if you like, they are the older versions of cin and cout (Basically the C versions of these C++ functions). They can do what you need them to do but like I said earlier, you will be limited to preset size limits since you have to use character arrays instead of strings. This is why I don't use them, less memory issues unless you can control the data that is coming in like lets say a window application reading in an edit box.