有那個大大會Dev-c++ 4.9.9.2的程式[已解決]

Home Home
引用 | 編輯 阿鋒
2005-10-06 00:21
樓主
推文 x0
因為我只小懂c++ builder6
後來朋友問我會不會c++!我說小懂
他就問我問題了!因為他明 ..

訪客只能看到部份內容,免費 加入會員



獻花 x0
引用 | 編輯 jemic
2005-10-06 00:34
1樓
  
複製程式
 
 int main()
{
       int a[4],i,j,temp;
       for (i=0;i<4;i++)
       {
        printf("Enter number %d:",i+1);
        scanf("%d",&a[i]);
    }
    for (i=0;i<=2;i++)
    {
        for (j=i+1;j<=3;j++)
            if (a[i]<a[j])
                {
                    temp=a[i];
                    a[i]=a[j];
                    a[j]=temp;
                }
    }
    printf("\n");
    printf("Max to Min:");
    for (i=0;i<4;i++)
       {
        printf("%d ",a[i]);
    }
       
       
}

打玩收工...

c++的api請自行替換

獻花 x1
引用 | 編輯 kevinliao
2005-10-06 12:10
2樓
  
這純粹只是 c++ 的問題, 跟你用 bcb or dev-c++ 應該是無關的, 你若能在 bcb 上寫出解決此問題的程式, 沒有理由在 dev-c++ 上不 work...

獻花 x1
引用 | 編輯 阿鋒
2005-10-06 22:48
3樓
  
就因為devc++.....沒用過!還有我也不知表單在那裡做…

獻花 x0
引用 | 編輯 阿鋒
2005-10-07 23:15
4樓
  
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
  {
int a, b, c, d, t;
cout << "請輸入a的數字=";
cin >> a;
cout << "請輸入b的數字=";
cin >> b;
cout << "請輸入c的數字=";
cin >> c;
cout << "請輸入d的數字=";
cin >> d;
if (a<b)
{t=a; a=b; b=t;}
if (a<c)
{t=a; a=c; c=t;}
  if (a<d)
  {t=a; a=d; d=t;}
  if (c<d)
{t=c; c=d; d=t;}
  if (b<d)
{t=b; b=d; d=t;}
if (b<c)
{t=b; b=c; c=t;}
cout <<a<< ">=" <<b<< ">=" <<c<< ">=" <<d<< endl;
 
  system("PAUSE");
  return EXIT_SUCCESS;
}
}

這個才是答案= =|||上面那個是c++b的

獻花 x0