Hello, I was given the exercise below at school. I have read the chapter many times but I cannot find a way to gather string variables and double variables at the same time from the file. Creating these functions is proving difficult. I appreciate any help in advance This is what the exercise looks like:
Write a program to read in the following file:
GPA.txt
Alvin 2.5
Arthur 4.0
Bart 1.0
Beavis 0.0
Buttercup 3.8
Donald 1.5
Homer 1.0
Mickey 3.9
Pebbles 1.4
Pikachu 2.0
Shaggy 1.2
Spiderman 2.9
Tweety 2.0
Wilma 2.3
Yogi 4.0
Store the names in an array of strings and the GPAs in an array of doubles.
Create a function that takes in the array of strings and the array of doubles and returns the name and GPA of the student with the lowest GPA.
Create a function that takes in the array of strings and the array of doubles and returns the name and GPA of the student with the highest GPA.
Create a function that takes in the array of strings and the array of doubles and returns the average GPA.
Call all three of your functions from main and display their values to the screen.
I wanted to ask you the same thing. You used the variable without any declarations so i could not understand " while (cin >> name >> student_gpas)
{
student_names[ student_count ] = name;
student_gpas[ student_count ] = student_gpas;
student_count += 1;
} "
I need to store the names in one arraqy and the averages in another array.