求C++程序(给的正确的话可以提高分数到100分哦!)

来源:百度知道 编辑:UC知道 时间:2024/05/21 08:09:48
求一个C++程序,程序的要求是:写一个程序然后将其他程序的类分出来,就是要具体输出程序中出现的每个基类,还有派生类,把基类和派生分开来
请各位高手在1号前给出答案,万分感谢!
对于高手当然简单啊,
可我要完整的程序啊!!!

只考虑最简单的情况

#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;

string input_code;//记录输入的程序
vector<string> level0, level1;//只考虑一级情况

int anay_code(char *path) {
ifstream fin(path);
if(!fin.is_open() ){
return -1;
}
string str;
while (getline(fin, str)) {
size_t pos = str.find("class");
if(string::npos != pos) {//这一行里面包含关键字class,提取类
string class_name = "";
pos += 4;//跳过class
while(str[++pos] == ' ');//跳空格

while(isalpha(str[pos])) {//找类名
class_name += str[pos];
++pos;
}
if(str.find("public") != string::npos || str.find("private") != string::npo