Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main() {
- ifstream fin;
- fin.open("test4.cpp", ios::in);
- char start_char ;
- string define_name;
- string defined_value;
- while (!fin.eof() )
- {
- fin.get(start_char);
- if(start_char == '#')
- {
- fin.get(start_char);
- cout<<start_char;
- if(start_char == 'd')
- {
- while(start_char != ' ')
- {
- fin.get(start_char);
- cout<<start_char;
- }
- fin.get(start_char);
- cout<<start_char;
- while(start_char != ' ')
- {
- define_name += start_char;
- fin.get(start_char);
- cout<<start_char;
- }
- fin.get(start_char);
- cout<<start_char;
- while(start_char != ' ' && start_char != '\n')
- {
- defined_value += start_char;
- fin.get(start_char);
- cout<<start_char;
- }
- cout << "Definition name: " + define_name << endl;
- cout << "Defined Value: " + defined_value << endl;
- }
- }
- for(int i = 0; i < define_name.length(); i++)
- {
- if(start_char == define_name[i])
- {
- fin.get(start_char);
- if(start_char == define_name[i+1])
- {
- cout << defined_value << endl;
- fin.get(start_char);
- }
- }
- }
- cout<<start_char;
- }
- std::getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement