阿尔法狂想曲字幕组吧 关注:20贴子:1,633
  • 6回复贴,共1

Windows 版本字幕组管理程序

只看楼主收藏回复

// @Guanrenfu
// 百度还会河蟹凡……♂科网域名,所以 [字幕组官网] 部分请替换成字幕组官网网址。(只需替换即可,无需改动 \" 符号)
// 请使用 Orwell Dev-C++ 5.8.3(在 sourceforge.net 搜索并下载安装)编译。
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <cstdlib>
#include <conio.h>
using namespace std;
const string datafile = "afsg_members.dat";
const int MAX = 50;
fstream fio(datafile.c_str(), ios_base::in | ios_base::out | ios_base::binary);
struct
{
unsigned id;
char name[MAX];
char pos[MAX];
} member;
inline void eatline()
{
while (cin.get() != '\n')
continue;
}
inline void wlpause()
{
cout << "Press any key to continue..." << endl;
getch();
}
int main()
{
string loader;
char op;
int ctr, num;
system("title Alpha Fantasia Subs Group");
system("color 02");
for (int i = 0; i <= 20; i++)
{
clrscr();
cout << setw(40) << right << "Alpha Fantasia Subs Group" << endl;
cout << "Please wait while loading..." << endl;
cout << loader << endl;
cout << i * 5 << "%" << endl;
loader += "■";
usleep(50000);
}
cout << "Loaded Successfully!" << endl;
sleep(1);
while (true)
{
clrscr();
cout << setw(40) << right << "Alpha Fantasia Subs Group" << endl;
cout << "Welcome to AFSG!" << endl;
cout << setw(25) << left << "v. View members" << setw(25) << left << "a. Add members" << endl;
cout << setw(25) << left << "s. Our Site" << setw(25) << left << "q. Quit" << endl;
cin.get(op);
eatline();
switch (op)
{
case 'V':
case 'v':
fio.seekg(0);
cout << setw(10) << "ID" << setw(20) << "Name" << setw(20) << "Position" << endl;
for (ctr = 0; fio.read(reinterpret_cast<char *>(&member), sizeof member); ctr++)
{
cout << setw(10) << member.id
<< setw(20) << member.name
<< setw(20) << member.pos << endl;
}
fio.clear();
cout << ctr << " member" << ((ctr > 1) ? 's' : '\0') << " read." << endl;
wlpause();
continue;
case 'A':
case 'a':
cout << "How many members do you want to add? ";
cin >> num;
if (!cin)
{
cout << "Wrong Input! Back to Main Menu." << endl;
cin.clear();
eatline();
wlpause();
continue;
}
eatline();
fio.seekg(0);
while (fio.read(reinterpret_cast<char *>(&member), sizeof member));
fio.clear();
fio.seekp(0, ios_base::end);
for (ctr = 0; ctr < num; ctr++)
{
if (member.id == 0)
member.id = 10000;
else
member.id++;
cout << "Member #" << member.id << endl;
cout << "Enter Name (empty line to quit):" << endl;
cin.getline(member.name, MAX);
if (member.name[0] == '\0')
{
cout << "Wrong Name! Back to Main Menu." << endl;
break;
}
cout << "Enter Position (empty line to quit):" << endl;
cin.getline(member.pos, MAX);
if (member.pos[0] == '\0')
{
cout << "Wrong Position! Back to Main Menu." << endl;
break;
}
fio.write(reinterpret_cast<char *>(&member), sizeof member);
}
cout << ctr << " member" << ((ctr > 1) ? 's' : '\0') << " added." << endl;
fio.clear();
wlpause();
continue;
case 'S':
case 's':
system("start \"%PROGRAMFILES%\\Internet Explorer\\iexplore.exe\" \"[字幕组官网]\"");
wlpause();
continue;
case 'Q':
case 'q':
break;
default:
cout << "Input Error!" << endl;
wlpause();
continue;
}
break;
}
fio.close();
cout << "Bye!" << endl;
wlpause();
return 0;
}


来自Android客户端1楼2014-12-11 15:53回复
    Well, It's very interesting


    IP属地:上海2楼2014-12-11 16:46
    收起回复