標題:
五則運算 (二)
[打印本頁]
作者:
tonyh
時間:
2015-3-20 20:25
標題:
五則運算 (二)
本帖最後由 tonyh 於 2015-3-20 20:39 編輯
[attach]1178[/attach]
#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;
}
複製代碼
作者:
沈子耕
時間:
2015-3-20 20:43
#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;
}
複製代碼
作者:
曾挺桂
時間:
2015-3-20 20:43
#include <iostream>
#include<cstdlib>
using namespace std;
int main()
{
long x,y;
cout<<"請輸入x的值:";
cin>>x;
cout<<"請輸入x的值:";
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;
}
複製代碼
作者:
林侑成
時間:
2015-3-20 20:46
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x, y, z;
cout<<"請輸入x的值: ";
cin>>x;
cout<<"請輸入y的值: ";
cin>>y;
cout<<"請輸入z的值: ";
cin>>z;
cout<<x<<"+"<<y<<"/"<<z<<"="<<x+y/z<<endl;
cout<<x<<"*"<<y<<"-"<<z<<"="<<x*y-z<<endl;
cout<<x<<"%"<<y<<"+"<<z<<"="<<x%y+z<<endl;
cout<<x<<"-"<<y<<"*"<<z<<"="<<x-y*z<<endl;
cout<<x<<"/"<<y<<"%"<<z<<"="<<x/y%z<<endl;
system("pause");
return 0;
}
複製代碼
作者:
陳思惟
時間:
2015-3-20 20:50
#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;
}
複製代碼
作者:
曾挺桂
時間:
2015-3-20 21:16
#include <iostream>
#include<cstdlib>
using namespace std;
int main()
{
long 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;
}
複製代碼
作者:
林廷翰
時間:
2015-4-9 20:26
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;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2