1. Eren Yılmaz
  2. Yardım İsteyenler
  3. Çarşamba, Aralık 28 2016, 08:29 PM
  4.  E-posta abonesi olun

Write a C program which enables to insert values in a sorted array of numbers. The details of the program are:  

- User must enter exactly 10 distinct positive numbers (integers).  

- All numbers entered must be inserted into an array in ascending order. After insertion the order of the numbers in the array must be still ascending. Insertion must be performed on a separate user defined function!  

DO NOT USE SORTING! Students who use sorting will get 0 points!!! Write a function which finds the position to insert the number and then SHIFTS all other numbers in the array to the right!  

- After each insertion, all numbers entered so far must be printed using a separate user defined function!  

- If the number that the user entered is NOT positive, user must be prompted to enter again.   

- If entered number is already in the array, user must be prompted to enter again. This search operation must be performed on a separate user defined function!  

Örnek kod:

Enter the 1. number: 40 

> Current List = 40

Enter the 2. number: 6

> Current List = 6 40

Enter the 3. number: 17

> Current List = 6 17 40

Enter the 4. number: 6

> ERROR: 6 is already in the list!

Enter the 4. number: 96

> Current List = 6 17 40 96

Enter the 5. number: -77

>ERROR: -77 is not POSITIVE!

Enter the 5. number: 0

> ERROR: 0 is not POSITIVE!

Enter the 6. number: 7

> Current List = 6 7 17 40 96

Enter the 7. number: 33

> Current List = 6 7 17 33 40 96

Enter the 8. number: 64

> Current List = 6 7 17 33 40 64 96

Enter the 9. number: 33

> ERROR: 33 is already in the list!

Enter the 9. number: 81

> Current List = 6 7 17 33 40 64 81 96

Enter the 10. number: 58

> Current List = 6 7 17 33 40 58 64 81 96

!!! THE END !!!  

 

 

soru bu asıl problem hoca sort  kullanmayacaksınız dedi .Numarayı yerleştirme konumunu bulan bir işlevi yazın ve ardından dizideki diğer tüm sayıları sağa kaydırın diyo kac gündür ugrasıyorum stabil calısan bi kod yazamadım yerdım ederseniz



There are no replies made for this post yet.
However, you are not allowed to reply to this post.