I need help with my homework plz Help

First of all hello everyone Im a first year Computer Engineer.Because of my English pres Exam I started university 3 weeks late and I missed a lot of things. This is my first homework and I really need help .Im thinking about using if statement
So my homework is to write a program that user will enter his/her student ID and program will show the year, faculty name, department name and student no. Assume that all students are registered after 2000. The number is 10 digit for example if your student I’d is 1801023100 output will be Year:2018 Faculty:Faculty of Engineering Department:Computer Engineering Student no :3100 There are 8 faculties and a lot of departments How can I write this program please help I have 5 days left
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
using namespace std;

struct Student
{
    string ID;
    int year;
    string faculty;
    string department;
    int studentNo;
};

// Reads the data for a student
Student read_student()
{
    Student s;
    cout << "Enter ID: "; cin >> s.ID;
    cout << "Enter year: "; cin >> s.year;
    cout << "Enter faculty: "; cin >> s.faculty;
    cout << "Enter department: "; cin >> s.department;
    cout << "Enter studentNo: "; cin >> s.studentNo;

    return s;
}

int main();
{
    // Getting some student's data from console:
    vector<Student> student_v;
    while (true)
    {
         cout << "Do you want enter the data of another student? (y/n) ";
         string input;
         getline(cin, input);
         if (input[0] == 'y' || input[0] == 'Y')
         {
            Student s = read_student;
            student_v.push_back(s);
         }
         else
         {
              break;  // breaks out the while loop
         }
    }

    // finding students by ID;
    while (true)
    {
        string input;
        cout << "Do you want to seach a student by ID? (y/n)\n";
        getline( cin, input);
        if (input[0] == 'n' || input[0] == 'N') break; // outbreak from while
        cout << "Enter an ID: "
        getline( cin, input);
        bool student_found = false; // A flag which gets true if a student was found.
        for( Student & s : student_v)
        {
            if (s.ID == input)
            {
                 cout << "Year:"<<s.year
                      << " Faculty:"<<s.faculty
                      <<" Department: "<<s.department
                      <<" Student no:" << s.studentNo 
                      << '\n';
                student_found = true;
                break;  // A student was found, so we can abort the for-loop.
            }
        }
        if (student_found == false) cout << "Sorry no student which this ID found.\n";
    }
}
Thank you so much
Topic archived. No new replies allowed.