- 分享
- 0
- 人气
- 0
- 主题
- 5
- 帖子
- 4516
- UID
- 140257
- 积分
- 10923
- 阅读权限
- 25
- 注册时间
- 2008-5-2
- 最后登录
- 2021-2-3
- 在线时间
- 3371 小时
    
|
今天又学了一些比较复杂的code...
不过对高手来说还是太简单了吧...
话说头脑不厉害转的话要学写code有点吃力~- #include<iostream>
- using namespace std;
- int main()
- {
- //declare three integers
- int a,b,c;
- cout<<"Enter 3 numbers\n";
- cin>>a>>b>>c;
- cout<<"sum of the three integers = "<<a+b+c<<"\n";
- cout<<"average of the three integers = "<<(a+b+c)/3<<"\n";
- cout<<"product of the three integers = "<<a*b*c<<"\n";
- if(a>b)
- {
- if(a>c)
- {
- cout<<a<<"is the largest\n";
- }
- else
- {
- cout<<c<<"is the largest\n";
- }
- }
- else
- {
- if(b>c)
- {
- cout<<b<<"is the largest\n";
- }
- else
- {
- cout<<c<<"is the largest\n";
- }
- }
-
- if(a<b)
- {
- if(a<c)
- {
- cout<<a<<"is the smallest\n";
- }
- else
- {
- cout<<c<<"is the smallest\n";
- }
- }
- else
- {
- if(b<c)
- {
- cout<<b<<"is the smallest\n";
- }
- else
- {
- cout<<c<<"is the smallest\n";
- }
- }
-
- return 0;
- }
复制代码- #include<iostream>
- using namespace std;
- int main()
- {
- int x=3;
- while(x>0)
- {
- cout<<"x="<<x<<"\n";
- x --;
- }
- return 0;
- }
复制代码 话说x --;的那个部分放++的话
不懂会跑到几时的说~ |
|