初学C++,练习代码
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
/*
**简单歌词分析:
**根据开始时间和结束时间 来显示
*/
void readLyric(string fileName);
void analysisOneLine(string str);
void printLyric();
void getLyricHeader(string str);
int changeStringToInt(string str_time);
void timeSort();
const int MAX_LYRIC_LINE_NUM =200;
const int MAX_LYRCE_REPEAT_NUM = 10;
string header[] = {"ai:", "ar:", "al:", "by:"};
int lineNum = 0;
string Lheader[4];
struct OneLineLyric
{
int lineNum;
string startTime;
string endTime;
string lyricContent;
} lyric[MAX_LYRIC_LINE_NUM ]; //动态分配最好
void readLyric(string fileName)
{
ifstream fin;
fin.open(fileName);
if(!fin.is_open())
{
cerr << "文件读取失败!\n";
exit(0);
}
string str;
getline(fin, str);
while(fin)
{
if(str != "