//승패 구하기. {{{~cpp #include #include using namespace std; int main() { ifstream fin("data1.txt"); cout<<"선호형과 인수형의 승패 구하기\n"; char buf[10]; char a; int temp1,temp2; int count1=0,count2=0,count3=0; fin.getline(buf,10); cout << buf << endl; fin.getline(buf,10); cout << buf << endl; for (int i=0; i<100; i++) { fin.get(a); temp1=a; fin.get(a).get(a); temp2=a; if(temp1>temp2) { if(temp1 == '2' && temp2 == '0') { count3++; } else count1++; } else if (temp1==temp2) { count2++; } else if (temp1 < temp2) { if(temp1== '0' && temp2 == '2' ) { count1++; } else count3++; } fin.get(a); } cout << count1 << " " << count2 << " " << count3 << endl; return 0; } }}}