Objects Classification

Hello guys. I am trying to edit the code that I have developed previously. After editing it, I have some problem with
1
2
3
4
MOVIE movies;
    if (readStatus = ReadFile(movies, movieCount))
        return readStatus;
    showmovielist(movies, movieCount);


Can you guys help me with it.
Link to new code : https://docs.google.com/document/d/1dE7UYO7UOjFjcdBQGmB4F33b7dxDyqgLNO5Y6_xKJD8/edit?usp=sharing
Link to the old code :
https://docs.google.com/document/d/1dpQqUwtayzfB_jKLmVaTCtYYib7cpaOgDV8V2di2eX8/edit?usp=sharing

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  update_movie()
{
    fstream movie, temp;
    int lines, movieCount{}, readStatus{};
    char selection_movie1, name [25], time1[25], time2[25], time3[25];
    movie.open("Movies.txt",ios::in);
    temp.open("temp.txt",ios::out);

    MOVIE movies;
    if (readStatus = ReadFile(movies, movieCount))
        return readStatus;
    showmovielist(movies, movieCount);

    cin.ignore();
    cout << endl;
    cout << "Enter the serial number of the movie that you want to update [1,2,3...]: ";
    cin >> selection_movie1;

    char count = '0';
    string line;

    ifstream file("Movies.txt");
    while (!file.eof())
    {
        getline(file, line);
        count++;
    }

    lines = count - 50 ;

    while((selection_movie1 <= '0') || (selection_movie1 > count))
    {
        cout << endl;
        cout << "Sorry! You have entered a wrong selection. Please try again." << endl << endl;
        cout << "Please select a movie: ";
        cin.ignore(std::numeric_limits <std::streamsize>::max(), '\n');
        cin >> selection_movie1;
    }

    selection_movie = (selection_movie1 - 48);

    cout << endl;

    int i = 0;
    while(i++ , i <= count)
    {
        movie.getline(name,25,'|');
        movie.getline(time1,25,'|');
        movie.getline(time2,25,'|');
        movie.getline(time3,25);

        if (i == selection_movie)
        {
            int time[3] = {}, x = 0;
            cout << " Enter the time for First show  (HHMM): ";
            cin >> time[0];
            time_checking(time, x);
            i = 1;

            cout << " \nEnter the time for Second show (HHMM): ";
            cin >> time[1];
            time_checking(time, x);
            i = 2;

            cout << "\n Enter the time for Third show  (HHMM): ";
            cin >> time[2];
            time_checking(time, x);
            temp << name << '|' << time[0] << '|' << time[1] << '|' << time[2] << '\n';
        }

        else
        {
            temp << name << '|' << time1 << '|' << time2 << '|' << time3 << '\n';
        }

    }
    temp.close();
    movie.close();

    movie.open("Movies.txt",ios::out);
    temp.open("temp.txt",ios::in);

    int y = 0;
    do
    {
        temp.getline(name,25,'|');
        temp.getline(time1,25,'|');
        temp.getline(time2,25,'|');
        temp.getline(time3,25);
        movie << name << '|' << time1 << '|' << time2 << '|' << time3 << '\n';
        y = y + 1;
    }while (y <= lines);

    temp.close();
    movie.close();

    cout << "\n You have done editing the showtime manager!!! \n";
    remove("temp.txt");
}
Please don't start a new topic on the same subject.

Can you guys help me with it.


Not a smart question.

http://www.catb.org/esr/faqs/smart-questions.html
Last edited on
What is L10 supposed to do? What does ReadFile() return?

The loop L23/27 won't work as you re expecting. Try:

1
2
while (getline(file, line))
    ++count;

Last edited on
Topic archived. No new replies allowed.