c++ array question ?

Write a program for a one dimensional integer array A with maximal number of elements =1000 (const=1000) that:

a) Input by the keyboard the number N of the concrete array;
b) Input the elements of the array from the keyboard (i) or from the text file F1 (ii) or randomly generate the array (iii);
c) Finds: (c1) the values of the first minimal (min) and the first maximal (max) element of the array A and their indices imin and imax; (c2) the indices of all minimal and all maximal elements that should be write to the array INDMIN and INDMAX, respectively; (c3) Sort the elements of the array A in decreasing order of the their values. Use any sorting algorithm (straight selection, quicksort, etc.);
d) Output the results from (c) to the screen of the computer monitor and to a text file F2.
I don't understand your question.

Please tell me again with clearifying.
I don't understand your question.


I'll re-phrase it for you: "Who is gullible enough to do my homework for me?"
oguzuslu:

Whether it is or is not the case, it certainly looks like you're trying to pawn off an assignment to the members of this forum. Give it a solid effort and ask for specific help on anything you're stuck.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

print "Enter a number in (0,1000]: ";
chomp( $n = <STDIN> );
die "Invalid array size!" unless( 0 < $n && $n <= 1000 );
if( $#ARGV >= 1 ) { $f = $ARGV[0]; }
else {
	print "Enter an output file: ";
	chomp( $f = <STDIN> );
}
$f =~ s/[<>]/_/g;
open F, ">$f";
push @a, int(rand(1999)) - 999 foreach (1..$n);
$mini = 0;
$maxi = 0;
foreach (0..$#a-1) {
	if( $a[$_] < $a[$mini] ) { $mini = $_; } 
	elsif( $a[$_] > $a[$maxi] ) { $maxi = $_; }
}
my @b = sort {$b <=> $a} @a;
sub printData {
	my $o = $_[0];
	print $o "The minimum value of $a[$mini] was element $mini\n";
	print $o "The maximum value of $a[$maxi] was element $maxi\n";
	print $o "Unsorted: @a\n";
	print $o "Sorted: @b\n";
}
&printData(STDOUT);
&printData(F);
close F;
@ jeff: I'm pretty sure that IS the case -> http://cplusplus.com/forum/beginner/42355/
Drue helped him learn nothing there which will only hurt him in the long run when he tries to move on to more advanced concepts without a solid grasp of the basics.

@ Mathhead: Thanks for that "Perl" of wisdom! BTW, I could do it quicker in Python. 8^p
Topic archived. No new replies allowed.