မဂၤလာပါခင္ဗ်ာ


ဧည့္သည္ေတာ္မ်ားကိုယ္စိတ္ႏွစ္ျဖာက်မ္းမာရႊင္လန္းၾကပါေစခင္ဗ်ာ။

C++ အိမ္စာမ်ား(၁၂)

အခုတင္ျပေပးမွာကေတာ့ သုညကေန ၁၀၀ အတြင္ Random ေခါက္ထားတာေလးကို ၾကီးစဥ္ငယ္လိုက္စီတာနဲ႔ ငယ္စဥ္ၾကီးလိုက္စီတာေလးပဲျဖစ္ပါတယ္။

#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int str[10],i,j,k,temp;
cout<<"The given String=";
for(k=0;k<10;k++)
  {str[k]=rand()%100;
   cout<<' '<<str[k];
  }
cout<<endl;
cout<<"Decending order=";
for(i=0;i<10;i++)
  {for(j=0;j<9-i;j++)
    {if(str[j]>str[j+1])
      {temp=str[j];
       str[j]=str[j+1];
       str[j+1]=temp;
      }
    }cout<<">"<<str[j];
  }
getch();
}
ဒါေလးကို ရမ္းလိုက္မယ္ဆိုရင္ ရလာမွာကေတာ့ ေအာက္ကပံုအတိုင္း (ၾကီးစဥ္ငယ္လိုက္) ဆင္တူျဖစ္ပါ့မယ္။

ငယ္စဥ္ၾကီးလိုက္ကေတာ့ > ကေန < လကၡဏာေလးေျပာင္းလိုက္ယံုပါပဲခင္ဗ်။
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
void main()
{
int str[10],i,j,k,temp;
cout<<"The given String=";
for(k=0;k<10;k++)
  {str[k]=rand()%100;
   cout<<' '<<str[k];
  }
cout<<endl;
cout<<"Decending order=";
for(i=0;i<10;i++)
  {for(j=0;j<9-i;j++)
    {if(str[j]<str[j+1])
      {temp=str[j];
       str[j]=str[j+1];
       str[j+1]=temp;
      }
    }cout<<"<"<<str[j];
  }
getch();
}
အမ်ားအားျဖင့္ နားလည္ၾကမွာမို႔ ထပ္ဆင့္ရွင္းမျပလိုပါဘူးခင္ဗ်ာ။ အိမ္စာမ်ားကို ဆက္လက္တင္ျပေပးပါ့မယ္ခင္ဗ်။

Comments :

0 comments to “C++ အိမ္စာမ်ား(၁၂)”

Post a Comment

 

သြားလည္တတ္တဲ့ဖိုရမ္ေတြက

Subscribe Subscribe Subscribe

ေတာင္းပန္စကား

ငါတတ္ငါေတာ္ ငါအေက်ာ္ဟု၊ ငါေသာ္စိတ္ထား မရွိျငားလည္း၊ ငါကားငယ္ရြယ္ ဥာဏ္မၾကြယ္၍၊ အဘယ္သုိ႔လွ်င္ အမွားစင္အံ့၊ အၾကင္သူေတာ္ ပညာေက်ာ္သည္၊ ခၽြတ္ေခ်ာ္လြဲမွား ငါ့စကားကုိ၊ စိတ္ထားေဖြးျဖဴ ျပင္ေတာ္မူ။ (ရွင္အဂၢဥာဏ)

အေမာင့္ကိုေျပာခဲ့ခ်င္ရင္

လာလည္ၾကသူမ်ား

လာလည္ၾကၾကိမ္ေပါင္း

ဖတ္ၾကတဲ့ စာမ်က္ႏွာအေရအတြက္