#include "stdafx.h" #include <iostream> #include <string> #include "interface.h" #include "Group.h" #include "Student.h" using namespace std; void main() { char answer = 'y'; cout << "\tWELCOME to group manager! Copyrights MB(c)\n"; int action; string group_name; int quantity; int counter = 0; Group group; while (answer = 'y') { if (counter == 0) { cout << "Enter the name of group: "; cin >> group_name; cout << "Enter the quantity of students in this group: "; cin >> quantity; if (!cin) { cout << "\nWrong number!\n"; break; } Group group1(group_name, quantity); group = group1; } cout << "Choose the action: \n\t1 - Show all group\n\t2 - Add student\n\t3 - Show info about student(after creating)\n"; cin >> action; if (!cin) { cout << "\nWrong number!\n"; break; } string sname; switch (action) { case 1: group.showAllInfo(); break; case 2: { cout << "\nEnter student number: "; int student_number; cin >> student_number; if (!cin) { cout << "\nWrong number!\n"; break; } cout << "\nStudent's name:"; cin >> sname; cout << "\nStudent's age:"; int age; cin >> age; if (!cin) { cout << "\nWrong number!\n"; break; } cout << "\nStudent's average mark:"; float mark; cin >> mark; if (!cin) { cout << "\nWrong number!\n"; break; } cout << "\nStudent's course:"; int course; cin >> course; if (!cin) { cout << "\nWrong number!\n"; break; } Student student(sname, age, mark, course, student_number); group.setStudent(student, student_number); } break; case 3: int num; cout << "Enter the number of student"; cin >> num; if (!cin) { cout << "\nWrong number!\n"; break; } group.showThisStudent(num); break; default: cout << "Wrong number"; break; } counter++; cout << "Go on?y/n\n"; cin >> answer; } } 
  • Add the classes Group , Student - acade to the code
  • one
    Let's start with the fact that in while (answer = 'y') you hardly wanted an assignment, not a comparison ... Well, and then - how does it end? With an error? With some kind of diagnostics? What are you waiting for from her? In short, read for starters how to properly ask questions ... - Harry

0