#include <iostream>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <vector>
#include <algorithm>
usingnamespace std;
int counter, selection_movie;
constint WIDTH = 77, MAXMOVIES = 15;
class Movie
{
public:
string name, day, time1, time2, time3;
void print()
{
cout
<< name << ' ' << day << ' '
<< time1 << ' ' << time2 << ' ' << time3
<< '\n';
}
};
int main()
{
Movie MOVIES[MAXMOVIES];
// ARRAY OF MOVIES
MOVIES[0] = Movie{"War and peace", "Wednesday", "10:30", "3:30", "7:30"};
MOVIES[1] = Movie{"Blue & Gray", "Thursday", "11:30", "4:30", "8:30"};
for( int i = 0; i < 2; i++)
MOVIES[i].print();
cout << '\n';
// VECTOR OF MOVIES
vector<Movie> movie_vec;
movie_vec.push_back(MOVIES[0]);
movie_vec.push_back(MOVIES[1]);
for(auto i: movie_vec)
i.print();
cout << '\n';
}
War and peace Wednesday 10:30 3:30 7:30
Blue & Gray Thursday 11:30 4:30 8:30
War and peace Wednesday 10:30 3:30 7:30
Blue & Gray Thursday 11:30 4:30 8:30
Program ended with exit code: 0
this is a repeated topic from last week, and all the tail chasing that ensued to understand why they wanted to remove the using and what was really being asked for etc.
I was wondering if there are any alternatives for "using"?
Clearly there are, especially given that was what was being asked for. The alternative is not to use using at all. The supplementary comments about vectors and c-style arrays is a bonus from several of us. 2 out of 3 being constructive isn't too bad I suppose.