#28614: 請問哪裡錯了??


s010563@student.cysh.cy.edu.tw (林家緯)


#include <iostream>

 

using namespace std;

 

int main()

{

    int ans;

    string s,t;

    while(getline(cin,s) && getline(cin,t))

    {

        ans=max(s[0],t[0])-min(s[0],t[0]);

        cout<<ans<<endl;

    }

 

    return 0;

}

#28617: Re:請問哪裡錯了??


Ststone1687 (Ststone)


#include

 

using namespace std;

 

int main()

{

    int ans;

    string s,t;

    while(getline(cin,s) && getline(cin,t))

    {

        ans=max(s[0],t[0])-min(s[0],t[0]);

        cout<<ans<<endl;

    }

 

    return 0;

}


試試看
Z
A
這組喔。
這樣應該是1才對。

不能用min max,這樣前比後大就會有問題喔。