Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  h
Language: C/C++
Code:
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
    ifstream fin;
    fin.open("Tag - P&ID C++ Data.txt");
    ofstream fout;
    fout.open("Generated P&ID.txt");
    int Ref = 870; //How many rows of refrenced -1
    int Sea = 396; // How many rows of searching -1
    string Tag_PID[2][870] = {""}; 
    string PID_No[396] = {""}; 
    string Tag = "";
    string PID = "";
        for(int i = 0 ; i <= Ref ; i++) {
            fin >> Tag >> PID;
            cout << Tag << "    " << PID << endl;
            Tag_PID[0][i] = Tag;
            Tag_PID[1][i] = PID;
        }
        cout << endl;
        for(int j = 0 ; j <= Sea ; j++) {
            fin >> Tag;
            for(int i = 0 ; i <= Ref ; i++) {
                if(Tag_PID[0][i] == Tag)    {
                    PID_No[j] = Tag_PID[1][i];
                    i = Ref;
                }
            }
        }
        for(int i = 0 ; i < Sea ; i++)  {
            fout << PID_No[i] << endl;
        }
    return 0;
}
Comments: