Im doing a program and it is asking me to do this.
Make a function named getData to interactively input data values into the variable listSize and then values into two parallel arrays, studentName and testScore, both of size listSize and return these values to the calling function. (Data validation: do not accept test score values outside the acceptable range of 0 through 100.)
The names are John Kathy Susan Alice and Bill
their test scores are 100 95 67 87 98
The output should look like this
The dialog generated by your program should be similar to the one below:
Enter size for arrays: 3
Enter 1th student name: Joanne
Enter test score for Joanne: -2
Re-enter test score for Joanne: 109
Re-enter test score for Joanne: 100
Enter 2th student name: Amy
Enter test score for Amy: 89
Enter 3th student name: Zack
Enter test score for Zack: 95
I dont really know how to start this at all. It would be nice if someone can help me start this, Thanks.
Also, you may want to go above and beyond and fix the problem of firth, seconth, and thirth by using an array of suffixes to use for the last digit in a number.
Try writing some code and when you get stuck, post it and state what you are stuck on.
Yes, but before the for loop, you actually need the arrays!
Recall the tutorial I gave you a link to about how to do this: http://www.cplusplus.com/doc/tutorial/dynamic/
Please read it.
Well, consider this (and possibly ask your teacher): what if you make the arrays some size like 100, what happens when the user wants to enter 101 students?
You need to get information from your teacher about how many students you should use as a maximum.
OK, then make your array of size five and then ask your user to tell the student names and grades "size" times. Remember that "size" is the variable you made when you asked the user how many students they wanted to enter.
According to the sample in your first post, you need to ask for the student name BEFORE the student grade. Also, you need to use index and not 1 where you wrote 1th.
Additionally, you still have a one dimensional integer array instead of a two dimensional character array: char studentName[SIZE][6];
The error is because you forgot the main function ;)
Also, you still didn't make studentName a two dimensional array that holds characters and not integers. I even gave you code you could copy and paste: char studentName[SIZE][6];