S
SneakyElf
i am very green with c++ so i get stuck on very simple things
anyway, i need to write a program that would
read data from file (containing names of tv shows and their networks)
one line at a time ( ; separates tv show and network)
sort the strings according to the network and according to the show.
and so:
//to open file -
ifstream myFile;
myFile.open ("tvshows.txt");
if (!myFile) {
cerr << "Error opening the file" << endl;
exit (1);
}
// the two arrays would be:
string showTitle [10];
string showNetwork [10];
i was thinking of using the linearsort() for sorting strings, however
i am litte confused as to how to read the data from the file into
arrays (since the one is titles and the other is network - how to tell
how to separate?)
and also would be be better to use a two-dimensional array in this
case?
as i said, not clear on the sorting at all
any topics (or websites) where i could read and improve my ever so
wonderful programming skills would be appreciated.
thanks.
anyway, i need to write a program that would
read data from file (containing names of tv shows and their networks)
one line at a time ( ; separates tv show and network)
sort the strings according to the network and according to the show.
and so:
//to open file -
ifstream myFile;
myFile.open ("tvshows.txt");
if (!myFile) {
cerr << "Error opening the file" << endl;
exit (1);
}
// the two arrays would be:
string showTitle [10];
string showNetwork [10];
i was thinking of using the linearsort() for sorting strings, however
i am litte confused as to how to read the data from the file into
arrays (since the one is titles and the other is network - how to tell
how to separate?)
and also would be be better to use a two-dimensional array in this
case?
as i said, not clear on the sorting at all
any topics (or websites) where i could read and improve my ever so
wonderful programming skills would be appreciated.
thanks.