![]() |
| ||
| what is the error please where is the error in this code doesn't run #include<iostream>Code indented and tags added. -Narue |
| ||
| Re: what is the error >ages[b-1]=ages[i]; That's your error. i isn't an index, it's a content value, and the value could very well exceed 999, which is the largest possible index for ages. Change that line to: ages[b-1]=ages[b];You probably also want to restructure your code so that it has specific sections for initializing the array, sorting the array, and printing the sorted array: #include<iostream>I'm also not sure if you really wanted this functionality or not, but as it is the sort is descending, not ascending, which is the most common preference. |
| ||
| Re: what is the error thanks a lot Naure |
| All times are GMT -4. The time now is 4:54 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC