#10673: 求解為何第二測資NA


o0931051998 (cian pan)

學校 : 國立雲林科技大學
編號 : 50993
來源 : [123.205.89.53]
最後登入時間 :
2017-06-18 23:51:12
a038. 數字翻轉 | From: [123.205.89.212] | 發表日期 : 2016-01-31 22:39

#include <iostream>
#include <math.h>
#include <cstring>
using namespace std;
int main()
{
char str[200],s,j;
while(cin.getline(str,200)){
s=strlen(str)-1;
for(int i=s;i>=0;i--){
if(str[i]>'0'){
j = i;
break;
}
}
for(int i=j;i>=0;i--){
cout<<str[i];
}
cout<<endl;
}
return 0;
}

 

執行時期錯誤

記憶體區段錯誤!Segmentation fault

 
ZeroJudge Forum