標題:
501 字串轉換
[打印本頁]
作者:
陳曜誌
時間:
2024-12-1 12:53
標題:
501 字串轉換
1. 題目說明:
請依下列題意進行作答,使輸出值符合題意要求。
2. 設計說明:
請撰寫一程式,讓使用者輸入長度不超過10字元的數字字串,將字串轉換為整數後,輸出原本的字串內容及轉換後的結果。
提示:需將字串轉換成整數。
提示:若使用 Java 語言答題,請以「JP」開頭命名包含 main 靜態方法的 class,評測系統才能正確評分。
3. 輸入輸出:
輸入說明
一個1~9位數的數字
輸出說明
原本的字串內容及轉換後的結果
範例輸入
123.456
範例輸出
123.456 change to 123
本帖隱藏的內容需要回復才可以瀏覽
作者:
錢冠叡
時間:
2024-12-4 19:53
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
getline(cin,str);
cout<<str<<" change to "<<stoi(str);
return 0;
return 0;
}
複製代碼
作者:
李彣
時間:
2024-12-4 19:54
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
getline(cin,str);
cout<<str<<" change to "<<stoi(str);
return 0;
}
複製代碼
作者:
侯宣任
時間:
2024-12-4 19:54
#include<bits/stdc++.h>
using namespace std;
int main()
{
string str;
getline(cin,str);
cout<<str<<" change to "<<stoi(str)<<endl;
return 0;
}
複製代碼
作者:
侯宣仲
時間:
2024-12-4 19:56
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
getline(cin,str);
cout<<str<<" change to "<<stoi(str);
return 0;
}
複製代碼
作者:
曾善勤
時間:
2024-12-4 19:56
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
cin>>str;
cout<<str<<"change to "<<stoi(str);
return 0;
}
複製代碼
作者:
黃裕恩
時間:
2024-12-4 20:01
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
getline(cin,str);
cout<<str<<" change to "<<stoi(str);
return 0;
}
複製代碼
作者:
林劭澧
時間:
2024-12-11 18:58
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
cin>>str;
cout<<str<<" change to "<<stoi(str);
return 0;
}
複製代碼
作者:
林劭杰
時間:
2024-12-11 18:58
#include<bits/stdc++.h>
using namespace std;
string str;
int main()
{
cin>>str;
cout<<str<<" change to "<<stoi(str);
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2