Okay I'm gonna be honest with you... I have no idea what I'm doing... no not even a little. I'm in an online C++ class that I'm only taking because it was the last required course for me to graduate this semester... This is the last assignment due and I honestly haven't got a clue where to start... The last assignments I did seemed fairly simple with a little research but this one has completely thrown me off.

If anyone felt like helping me out... or getting me started that'd be great and I'd love you forever. =P I was helped here before and I realize that you're kinda supposed to at least have a basis program or something... I promise you it's not that I'm trying to get anyone to just do my homework for me... I've stared long and hard at this trying to figure out what I should do first... =[ Help?

Here's the assignment:

Write a program that will read student names and percentage grades from the keyboard and then sort them (highest grade first) and calculate average, lowest and highest grade as shown below:

Example :
>How many students do you want to process?
4
>Enter name for student #1 :
JONES
>Enter grade for student #1 :
60
>Enter name for student #2 :
SMITH
>Enter grade for student #2 :
80
>Enter name for student #3
FORSTER:
>Enter grade for student #3 :
55
>Enter name for student #4 :
ALAZAR
>Enter grade for student #4 :
85

>====================
>CLASS GRADE REPORT :
>____________________

>ALAZAR B
>SMITH B
>JONES D
>FORSTER F
>_____________________

>HIGHEST GRADE : 80.00
>LOWEST GRADE : 55.00
>AVERAGE : 70.00
>=====================

I have finished it, but to don't violate the rules of this website --"Don't give away code" , I can not give you all my source code. The following is the framework of program. hope it can help you.

#include <iostream>
#include <vector>

using namespace std;

struct Student
{
  string name;
  float grade;
};

char convert(float grade)
{
  if (grade >= 90)
    return 'A';
  
  if ( grade >= 80)
    return 'B';
   .......
}

void sortStudents(vector<Student>& students)
{
   
} 

float getAverage(const vector<Student>& students)
{
  int size = students.size();
  float total = 0.0;
  
  for (int i=0; i<size; ++i)
  {
   ...............
  }
  
  return total / size;
}

void display(const vector<Student>& students)
{
  cout<<"===================="<<endl;
  cout<<"CLASS GRADE REPORT :"<<endl;
  cout<<"____________________"<<endl;
  
  int size = students.size();
  for (int i=0; i<size; ++i)
  {
    cout<<students[i].name<<"\t"<<convert(students[i].grade)<<endl;
  }
  
  cout<<"_____________________"<<endl;
  cout<<"HIGHEST GRADE : "<<students[0].grade<<endl;
  cout<<"LOWEST GRADE : "<<students[students.size() -1].grade<<endl;
  cout<<"AVERAGE : "<<getAverage(students)<<endl;
  cout<<"====================="<<endl;
} 

int main()
{	
  int number;
  vector<Student> students;
  cout<<"How many students do you want to process?"<<endl;	
  cin>>number;
  
  for (int i=0; i<number; ++i)
  {    
    Student temp;
    //deal with the input and then construct the struct 'temp'
    
    students.push_back(temp);
  }
  
  sortStudents(students);
  
  display(students);
  
  system("PAUSE"); 
  return 0;
}
commented: Helped me out greatly <3 +1

OMG I LOVE YOU! lol no really you're absolutely amazing! You pretty much saved me from not graduating this semester lol

<3333

kindly reminder, the sort function I posted don't work correctly, you should correct it by yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.