標題:
[隨堂測驗] 五則運算 (二)
[打印本頁]
作者:
李泳霖
時間:
2021-1-21 17:37
標題:
[隨堂測驗] 五則運算 (二)
使用 cin 讓使用者能自行指定 x 與 y 的值.
本帖隱藏的內容需要回復才可以瀏覽
作者:
馬琮翰
時間:
2021-1-21 18:01
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x=8,y=5;
cout<<"Insert X:";
cin>>x;
cout<<"Insert Y:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
複製代碼
作者:
朱春珠
時間:
2021-2-20 16:39
本帖最後由 朱春珠 於 2021-2-20 17:14 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x, y;
cout<<"請輸入x數值: ";
cin>>x;
cout<<"請輸入y數值: ";
cin>>y;
cout<<"當x等於"<<x<<",y等於"<<y<<"時..."<<endl;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
朱春男
時間:
2021-2-20 16:40
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x, y;
cout<<"請輸入x之數值: ";
cin>>x;
cout<<"請輸入y之數值: ";
cin>>y;
cout<<"當x等於"<<x<<", y等於"<<y<<"時..."<<endl;
cout<<"x+y="<<x+y<<endl;
cout<<"x-y="<<x-y<<endl;
cout<<"x*y="<<x*y<<endl;
cout<<"x/y="<<x/y<<endl;
cout<<"x%y="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡秉勛
時間:
2021-2-20 16:45
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x=10,y=3;
cout<<"Insert X:";
cin>>x;
cout<<"Insert Y:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"%"<<x+y<<endl;
system ("pause");
return 0;
}
作者:
陳志祐
時間:
2021-2-20 16:45
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"輸入x"<< endl;
cin>>x;
cout<<"輸入y"<< endl;
cin>>y;
cout<<"當x等於"<<x<<", y等於"<<y<<"時..."<<endl;
cout<<"x+y="<<x+y<<endl;
cout<<"x-y="<<x-y<<endl;
cout<<"x*y="<<x*y<<endl;
cout<<"x/y="<<x/y<<endl;
cout<<"x%y="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
謝苙豪
時間:
2021-2-20 16:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x之數值: ";
cin>>x;
cout<<"請輸入y之數值: ";
cin>>y;
cout<<"當x等於"<<x<<", y等於"<<y<<"時..."<<endl;
cout<<"x+y="<<x+y<<endl;
cout<<"x-y="<<x-y<<endl;
cout<<"x*y="<<x*y<<endl;
cout<<"x/y="<<x/y<<endl;
cout<<"x%y="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
林佑宸
時間:
2021-2-20 16:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x:";
cin>>x;
cout<<"請輸入y:";
cin>>y;
cout<<"當x="<<x<<",y="<<y<<"時..."<<endl;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system ("pause");
return 0;
}
複製代碼
作者:
富溢
時間:
2021-2-20 16:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x, y;
cout<<"lnsert x:";
cin>>x;
cout<<"lnsert y:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
鍾易澄
時間:
2021-2-20 16:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸x的值:";
cin>>x;
cout<<"請輸y的值:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡秉勛
時間:
2021-2-20 17:13
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x=10,y=3;
cout<<"Insert X:";
cin>>x;
cout<<"Insert Y:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"%"<<x+y<<endl;
system ("pause");
return 0;
}
作者:
周桓宇
時間:
2021-2-20 17:16
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x的值:";
cin>>x;
cout<<"請輸入y的值:";
cin>>y;
cout<<"當x等於"<<x<<",y等於"<<y<<"時..."<<endl;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
江家同
時間:
2021-3-4 19:16
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x的值:";
cin>>x;
cout<<"請輸入y的值:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
莊冠鈞
時間:
2021-3-6 15:00
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<"當x等於"<<x<<"y等於"<<y<<endl;
cout<<"x+y等於"<<x+y<<endl;
cout<<"x-y等於"<<x-y<<endl;
cout<<"x*y等於"<<x*y<<endl;
cout<<"x/y等於"<<x/y<<endl;
cout<<"x%y等於"<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
陳勤允
時間:
2021-3-6 15:00
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int a, b;
cout << "請輸入a和b:";
cin >> a >> b;
cout << "當a等於" << a << ",b等於" << b << "時" << endl;
cout << "a + b =" << a + b << endl;
cout << "a - b =" << a - b << endl;
cout << "a * b =" << a * b << endl;
cout << "a / b =" << a / b << endl;
cout << "a % b =" << a % b << endl;
system("pause");
return 0;
}
複製代碼
作者:
黃昱齊
時間:
2021-4-10 15:50
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x的值:"<<endl;
cin>>x;
cout<<"請輸入y的值:"<<endl;
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
陳佑俊
時間:
2021-4-21 20:49
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x的值:";
cin>>x;
cout<<"請輸入y的值:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"="<<x/y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
cout<<endl;
system("pause");
return 0;
}
複製代碼
作者:
許晏睿
時間:
2021-4-22 17:45
本帖最後由 許晏睿 於 2021-4-22 17:52 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x ,y ;
cout<<"請輸入x的值:";
cin>>x;
cout<<"請輸入y的直:";
cin>>y;
cout<<x<<"+"<<y<<"="<<x+y<<endl;
cout<<x<<"-"<<y<<"="<<x-y<<endl;
cout<<x<<"*"<<y<<"="<<x*y<<endl;
cout<<x<<"/"<<y<<"/"<<x+y<<endl;
cout<<x<<"%"<<y<<"="<<x%y<<endl;
system ("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2