https://www.mediafire.com/folder/0dxuju3ek4mdb//Lab2.0
I have a lab for school above are my materials. So far I have:
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
|
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <playlist.h>
#include <fstream>
#include <stdlib.h>
using namespace std;
void readLine(vector<string> playlist);
int totalTime();
void displayData();
int main()
{
vector<string> playlist;
open("Playlist.txt");
readLine(playlist);
totalTime();
displayData();
system("pause");
return 0;
}
void readLine(vector<string> playlist)
{
string currentline;
int i = 0;
while (getline("Playlist.txt", currentline) && !empty(currentline))
{
getline("Playlist.txt", playlist[i]);
i = i + 1;
}
}
int totalTime()
{
}
void displayData()
{
}
|
If someone could fix the two errors under "getline" and help me proceed I would deeply appreciate it!!!
Last edited on
You should also consider using alternatives for
system()
in your programs.
Something like:
1 2 3 4 5 6 7 8 9 10 11 12
|
#include <conio.h>
int main(){
/*
Your code
*/
// Here instead of using system("pause") use:
_getch(); // getch() is deprecated
return 0;
}
|
Last edited on
@AcarX
_getch() works only on windows, system is standard.
Yes getchar could be an alternative.