![]() |
|
![]() |
![]() |
|
~//.. يوميات عضو/هـ :: تجرد ذوآتهم بصمت .. كل ما يحدث من مواقف.. وطرائف.. وتجارب.. وما يجول بخواطرهم :: |
![]() |
#11 |
![]() ![]() ![]() |
![]()
حل سؤال input 500 numbers in array ; find the highest occurrence of x
#include <iostream.h> #include <stdio.h> int main() { int a[500] ; int c ,o , u , n ,t ,x; for(c=0;c<500;c++){ cin>>a[c];} cout<<" Enter number to find "; cin>>x; for(o=499;o>=0;o--){ if(a[o]==x){ n=o; } } cout<<" the highest occurrence is "<<n; g***har(); return 0; } + حل سؤال input 100 numbers in array ;transpose the array I,e make the last element the first and the first element the last . #include <iostream.h> #include <stdio.h> int main() { int a[100] ; int i , d , g ,t , r; for(i=0;i<100;i++){ cin>>a[i];} for(t=99,d=0;d<50;d++,t--){ r=a[d]; a[d]=a[t]; a[t]=r; } for(g=0;g<100;g++){ cout<<endl<<a[g];} g***har(); return 0; } حل السؤال العاشر اممم بصراحه مالقيت له حل ولا اعرف احله عشان ما توهق معك ![]() وهذا حل السؤال 12 اللي هو sort an array of 100 numbers . الحل كالتالي #include <iostream.h> #include <stdio.h> int main() { int a[100] ; int i ,j , d , temp ; // this section for input## cout<<" Enter 100 numbers \n"; for(i=0;i<100;i++){ cin>>a[i]; } // this section for sort array## for(j=0;j<100;j++){ for(d=j+1;d<100;d++){ if(a[j]<a[d]){ temp=a[j]; a[j]=a[d]; a[d]=temp; }}} // this section for come out## cout<<"\n the sort by largest is \n"; for(j=0;j<100;j++){ cout<<a[j]<<endl; } g***har(); return 0; } |
![]() |
مواقع النشر (المفضلة) |
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
انواع عرض الموضوع | |
|
|
![]() |
||||
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
ا مبراطور الشوق" رهين الشوق"يعانق ألفيته العاشره | عاشقة الدموع | oO التهاني والتبريكات | 8 | 2009-12-11 06:26 PM |
تعبير رهين الشوق | الشوق | همسات أهل الشوق | 4 | 2009-10-01 09:12 PM |