#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
int main() {
    string line;
	string number1,number2;
	while(1){
		fstream file;
		file.open("16g.dyr");
		cout << "Keyin Generator Number : ";
		cin >> number1;
		if(number1=="z") break;
		cout << "keyin value : ";
		cin >> number2;
		while( getline(file, line) ) {	
			if(line.find(number1) != string::npos) {
				if( line.find("IEEEX1") != string::npos ) {
					string::size_type comma = 0;
					for( int cnt = 0; cnt != 3; ++cnt ) 
						comma = line.find_first_of( ',', comma+1 );
					// output first two fields
					cout << line.substr( 0, comma+1 ) << " ";
					// output replacing number
					cout << number2; 
					// output remained fields
					comma = line.find_first_of( ',', comma+1 );
					cout << line.substr( comma ) << endl;
				} 
			}
		}
	}
} // main()
