Hey.
I'm currently working on a project where I'm suppose to read album titles including song names from a file into a 2d array. When I input the cd number, only that record should show up in the console.
E.g. Cd number: 1
Album title
Song 1
Song 2
Song 3
Song 4
Song 5
etc.
This is what I have done so far and I have no clue of where to go from tere. Please bare with me, just started working with c++. I'm using dev-c++.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string music[5][20];
int songnr = 0;
ifstream song1 ("song.txt");
if (song1.is_open())
{
while (! song1.eof() )
{
for (int x = 0; x < 5; x++){
for (int y = 0; y < 20; y++) {
cout<<"Song nr: ";
cin>>songnr;
if (songnr = 1){
getline (song1,music[x][y]);
cout << musik[x][y] << endl;
}
}
}
}
song1.close();
}
else cout << "Can't open";
cin.get();
system("PAUSE");
return EXIT_SUCCESS;
}