freopen("input1.txt", "r", stdin); int i = 0; while (cin >> buying1[i] >> selling1[i]) { index1[i]=i; i++; } cout << "--------------------------------" << endl; maxIndex1 = i; fclose(stdin); freopen("input2.txt", "r", stdin); i = 0; while (cin >> buying2[i] >> selling2[i]) { index2[i]=i; i++; } cout << "--------------------------------" << endl; maxIndex2 = i; fclose(stdin); freopen("input3.txt", "r", stdin); i = 0; while (cin >> buying3[i] >> selling3[i]) { index3[i]=i; i++; } cout << "--------------------------------" << endl; maxIndex3 = i;