標題:
五則運算進階
[打印本頁]
作者:
tonyh
時間:
2012-3-14 11:09
標題:
五則運算進階
本帖最後由 tonyh 於 2012-3-14 11:17 編輯
讓使用者自行輸入x與y的值
#include<iostream>
using namespace std;
int main()
{
int x, y;
cout<<"請輸入x的值: ";
cin>>x;
cout<<"請輸入y的值: ";
cin>>y;
cout<<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<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蔡岳凌
時間:
2012-3-14 15:56
#inclde<iostream>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x的值: ";
cin>>x;
cout<<endl;
cout<<"請輸入y的值: ";
cin>>y;
cout<<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<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause")
return 0;
}
複製代碼
作者:
黃睿帆
時間:
2012-3-21 13:18
#include<iostream>
using namespace std;
int main()
{
int x, y;
cout<<"請輸入x的值: ";
cin>>x;
cout<<"請輸入y的值: ";
cin>>y;
cout<<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<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
蘇冠鈞
時間:
2012-3-21 13:20
#include<iostream>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x的值: ";
cin>>x;
cout<<endl;
cout<<"請輸入y的值: ";
cin>>y;
cout<<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<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
作者:
鄭睿恒
時間:
2012-3-28 13:00
回復
1#
tonyh
#include<iostream>
using namespace std;
int main()
{
int x, y;
cout<<"請輸入x的值: ";
cin>>x;
cout<<"請輸入y的值: ";
cin>>y;
cout<<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<<x<<"%"<<y<<"="<<x%y<<endl;
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2