MusicType.cpp
1.24 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "MusicType.h"
// Ǻ
// Set student song Name from keyboard.
void MusicType::SetNameFromKB()
{
cout << "\tsong Name : ";
cin >> Name;
}
// Set Singer Name from keyboard.
void MusicType::SetSingerFromKB()
{
cout << "\tSinger : ";
cin >> Singer;
}
// Set Album Name from keyboard.
void MusicType::SetAlbumFromKB()
{
cout << "\tAlbum : ";
cin >> Album;
}
// Set Genre from keyboard
void MusicType::SetGenreFromKB()
{
cout << "\tGenre : ";
cin >> Genre;
}
// Set Lyrics from keyboard
void MusicType::SetLyricsFromKB()
{
cin.ignore();
cout << "\tLyrics : ";
getline(cin, Lyrics);
}
void MusicType::SetNumFromKB()
{
cout << "\tNumber : ";
cin >> Num;
}
// Set student record from keyboard.
void MusicType::SetInfoFromKB()
{
//SetNumFromKB();
SetNameFromKB();
SetSingerFromKB();
SetAlbumFromKB();
SetGenreFromKB();
SetLyricsFromKB();
SetPkey();
}
// Read a record from file.
int MusicType::ReadDataFromFile(ifstream& fin)
{
fin >> Name;
fin >> Singer;
fin >> Album;
fin >> Genre;
getline(fin, Lyrics);
return 1;
};
// Write a record into file.
int MusicType::WriteDataToFile(ofstream& fout)
{
fout << endl;
fout << Name << " ";
fout << Singer << " ";
fout << Album << " ";
fout << Lyrics << " ";
return 1;
}