Object

Write a program that the student information including name, and list their courses (including course name and grade) is to manage.
Description:
Students will then receive a number of command line arguments array dynamic (Heap) of pointers to be given to students .
Program, at least two classes is called the Student and the Lesson.
After the program, the menu is as shown below

1. Add a student
2. Add lesson to student
3. show average of a student
4. show general average
5. show lessons and marks of a student
0. Exit of program
Enter your choice:


After receiving a user selection, using the switch, the work to be done again above and wait for the command menu (choice D) is.
The menu:
1. Name and number of courses and students receive a student-created object (Heap) and placed on the list is a list of courses in the Heap.
2. Number of students is received and after reviewing it, scores, the course name to be added to the list of courses the students.
3. Number of students is received and after consideration of its existence, the GPA will be published.
4. Students can print the entire GPA (grade point average the student, just a number to be printed).
5. Number of students to receive and then review it, along with the names of students whose scores will be published.


Some attention:
Student numbers, the index is an array of Student object is stored in the first student to zero, the second one, ...
Obtained free of Heap memory in the appropriate places (such as grinding function) are not forgotten.
Classes are at least two constructor overload
Class members are properly private or public.
Each class has its own appropriate behavior and conduct additional writing for it to be avoided.
6. Two classes named, no console input or output operation.
[b]
[/b]



#include "stdafx.h"
#include "iostream"
#include "cstring"
#include<cstdlib>
using namespace std;
class lesson
{
char name[50];
int mark;
public:
lesson();
void setname(char name[])
{
strcpy(this->name,name);
}
void setmark(int mark)
{
this->mark=mark;
}
char *getname()
{
return name;
}
int getmark()
{
return mark;
}
};
class student
{
lesson *les;
char *firstname;
char *lastname;
int *codstudent;
int index;
int max;
public:
student();
student(const char *name,const char *famili,int *cod,int *number)
{
firstname = new char[strlen(name)+1];
strcpy(firstname,name);
lastname = new char[strlen(famili)+1];
strcpy(lastname,famili);
codstudent = new int ;
*codstudent=*cod;
les = new lesson[*number];
index = 0;
max = *number;
}
void addlesson(char name[],int number)
{
if(index == max)
{
cout << "full is lesson list: ";
}
else {
les[index].setname(name);
les[index++].setmark(number);
}
};
double avrage()
{
if(index==0)
{
cout << "no avrage: ";

}

else {
double av;
for (int x=0;x<index;x++)
{
av=av+les[x].getmark();
}
return av/index;
}
};
int menu()
{
char ch;
cout << endl;
do
{
cout << "(E)nter: " << endl;
cin >> ch;

}while(!strchr("e",tolower(ch)));
return tolower (ch);
}
void setnumber(int number)
{

}
};
class studentmaneger:public student
{

public:

studentmaneger()
{
}




};
void main()
{
student student;

int numberstudent;
cout << "number of student: ";
cin >> numberstudent;
student.setnumber(numberstudent);
char choice;
choice = student.menu();



}


Please help me


Last edited on
OK, I "Object"! To posting homework questions without showing any code or asking a specific question.
I also object. But I was conflicted about whether simply ignoring it was better. So I'll jump on the criticism bandwagon while the post is at the top of the forum.

Method for solving said problem:

Solve said problem.
Last edited on
lol yeah, it's a good problem for me... but there's no way i would show you the code so you can get an A++ lol (You see what i did there :D)
Topic archived. No new replies allowed.