-------------------------------------------------------------------------------------
#include <iostream>
#include <cctype)
using namespace std;
int main()
{
char ch;
int alpha;
int blank;
cout << "輸入任一個字元,我便能辨別他:"<<endl;
cin.get(ch); //接收到的字元符號
while(ch!='a') //給while迴圈一個辨別的\依據
{
if(isalpha(ch))
{
cout<<"you get the alpha!!!!";
break;
}
else if(isblank(ch))
{
cout<<"you get the blank";
break;
}
else
break;
}
return 0;
}
----------------------------------------------------------------------------------
上面是個簡單的寫法,可以使用各種不同的方法嘗試,當然也可以用C語言來試試看。
沒有留言:
張貼留言