:
Write a C program that reads the size N of an integer Array called T (maximum size: 50 components),then :
- Fills the Array by values and displays the Array.
- Clear all occurrences of the value 0 in the Array T and squeeze (regroup) the remaining elements.
- Display the resulting Array.
|
السلام عليكم ورحمة الله وبركاته :)
أتوقع ان الحل زي كذا :
1. تعرف ثابت ( define ) اسمه MAX مثلاً وقيمته 50
2. تعرف array من الـنوع int
3. تكتب دالة الـ Fill in المعروفة ( والـ rsize ) لازم يكون Reffrence لان هو حيتغير
rsize ++
4. بعدين يطبع الـ array وبما ان الـ array نوعها int وليس char
ما تقدر تطبع array كامله في وقت واحد .. فـ تخلي البرنامج يطبع عنصر عنصر ..
5.
Clear all occurrences of the value 0 in the Array T
|
ما اعرف بالزبط ايش مفروض يسير هنا لكن
اعتقد انك اول شي تعمل search وإذا كان العنصر = صفر
تستخدم معاه داله الـ delete
6.
squeeze (regroup) the remaining elements
|
المفروض ان نفس دالة الـ delete تسوي shift
وينقص rsize --
7.
Display the resulting Array
|
تطبع الـ array بعد التغيير
موفق :-)