標題:
四則運算(三)
[打印本頁]
作者:
歐柏罕
時間:
2017-11-11 17:03
標題:
四則運算(三)
#include<iostream> //輸入輸出
#include<cstdlib> //函式庫
using namespace std;
int main()
{
int num1 = 0;
int num2 = 0;
cout << "請輸入數字" << endl;
cin >> num1;
cout << "請輸入數字" << endl;
cin >> num2;
cout << num1 << " + " << num2 << " = " << num1+num2 << endl; //變數相加
cout << num1 << " - " << num2 << " = " << num1-num2 << endl;
cout << num1 << " * " << num2 << " = " << num1*num2 << endl;
cout << num1 << " / " << num2 << " = " << num1/num2 << endl;
cout << num1 << " % " << num2 << " = " << num1%num2 << endl;
system("pause");
return 0;
}
複製代碼
作者:
戴嘉禾
時間:
2017-11-11 17:06
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int num1 = 0;
int num2 = 0;
cout << "請輸入數字" << endl;
cin >> num1;
cout << "請輸入數字" << endl;
cin >> num2;
cout << num1 << " + " << num2 << " = " << num1+num2 << endl;
cout << num1 << " - " << num2 << " = " << num1-num2 << endl;
cout << num1 << " * " << num2 << " = " << num1*num2 << endl;
cout << num1 << " / " << num2 << " = " << num1/num2 << endl;
cout << num1 << " % " << num2 << " = " << num1%num2 << endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡佳承
時間:
2017-11-11 17:08
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int num1=7;
int num2=5;
cout<<"請輸入數字";
cin>>num1 ;
cout<<"請輸入數字";
cin>>num2;
cout<<num1<<"+"<<num2<<"="<<num1+num2<<endl;
cout<<num1<<"-"<<num2<<"="<<num1-num2<<endl;
cout<<num1<<"*"<<num2<<"="<<num1*num2<<endl;
cout<<num1<<"/"<<num2<<"="<<num1/num2<<endl;
cout<<num1<<"%"<<num2<<"="<<num1%num2<<endl;
system("pause");
return 0;
}
複製代碼
作者:
顏詢
時間:
2017-11-11 17:08
本帖最後由 顏詢 於 2017-11-13 20:19 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int num1= 0 ;
int num2= 0 ;
cout<<"請輸入數字"<<endl;
cin>>num1;
cout<<"請輸入數字"<<endl;
cin>>num2;
cout << num1 << "+" <<num2<<"="<<num1+num2<<endl;
cout << num1 << "-" <<num2<<"="<<num1-num2<<endl;
cout << num1 << "*" <<num2<<"="<<num1*num2<<endl;
cout << num1 << "/" <<num2<<"="<<num1/num2<<endl;
cout << num1 << "%" <<num2<<"="<<num1%num2<<endl;
system("pause");
return 0;
}
複製代碼
作者:
顏可晴
時間:
2017-11-11 17:08
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int num1=0;
int num2=0;
cont<<"請輸錄數字"<<endl;
cin>>num1;
cont<<"請輸錄數字"<<endl;
cin>>num2;
cout<<num1<<"+"<<num2<<"="<<num1+num2<<endl;
cout<<num1<<"-"<<num2<<"="<<num1-num2<<endl;
cout<<num1<<"*"<<num2<<"="<<num1*num2<<endl;
cout<<num1<<"/"<<num2<<"="<<num1/num2<<endl;
cout<<num1<<"%"<<num2<<"="<<num1%num2<<endl;
system("pause");
return 0;
}
複製代碼
作者:
顏可昕
時間:
2017-11-11 17:09
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int num1=7;
int num2=5;
cout<<"請輸入數字"<<endl;
cin>>num1;
cout<<"請輸入數字"<<endl;
cin>>num2;
cout<<num1<<"+"<<num2<<"="<<num1+num2<<endl;
cout<<num1<<"-"<<num2<<"="<<num1-num2<<endl;
cout<<num1<<"*"<<num2<<"="<<num1*num2<<endl;
cout<<num1<<"/"<<num2<<"="<<num1/num2<<endl;
cout<<num1<<"%"<<num2<<"="<<num1%num2<<endl;
system("pause");
return 0;
複製代碼
作者:
佳
時間:
2017-11-11 17:10
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int num1=0;
int num2=0;
cout << "請輸入數字" << endl;
cin >> num1;
cout << "請輸入數字" << endl;
cin >> num2;
cout<<num1<<"+"<<num2<<"="<<num1+num2<<endl;
cout<<num1<<"-"<<num2<<"="<<num1-num2<<endl;
cout<<num1<<"*"<<num2<<"="<<num1*num2<<endl;
cout<<num1<<"/"<<num2<<"="<<num1/num2<<endl;
cout<<num1<<"%"<<num2<<"="<<num1%num2<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2