027.將輸入字串轉換為對應之整數輸出。
原發表者:orka
#include <iostream>
#include <cstring>
using namespace std;

void main()
{
int x=0;
char word[80];
cout << "Please Input word:";
cin >> word;
x=strlen(word);
for (int i=0;i<=x;i++)
{
 if (word[0] >= 58 || word[0] <= 47)
 {
    cout << "0" << endl;
 break;
 }
 if (word[i] <=58 && word[i] >=47)
 cout << word[i];
}
}

在此感謝當年在數位高手(NBP)分享的朋友,本人將資料彙整於此並盡量將當初發表者名稱註記。
arrow
arrow
    全站熱搜

    NBPBlog 發表在 痞客邦 留言(0) 人氣()